A method corrects the position and deviation of a syringe needle in a machine for automatically preparing intravenous medication. The machine includes an automatic actuator, together with a control system, in which are placed the syringe and a one-dimensional position sensor including a measuring plane. The correction method includes steps in which the position sensor obtains position coordinates of a first and a second point of the needle, and steps of correcting the position and deviation error of the needle, by the control system of the automatic actuator.