Method for correcting the position and deviation of a syringe needle in a machine for automatically preparing intravenous medication, the machine comprising an automatic actuator, together with a control system, in which are placed the syringe and a one-dimensional position sensor comprising a measuring plane, the correction method comprising the 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.