A magnetic positioning system and related method for automated or assisted eye-docking in ophthalmic surgery. The system includes a magnetic field sensing system on a laser head and a magnet on a patient interface to be mounted on the patient's eye. The magnetic field sensing system includes four magnetic field sensors located on a horizontal plane for detecting the magnetic field of the magnet, where one pair of sensors are located along the X direction at equal distances from the optical axis of the laser head and another pair are located along the Y direction at equal distances from the optical axis. Based on relative magnitudes of the magnetic field detected by each pair of sensors, the magnetic field sensing system determines whether the patient interface is centered on the optical axis. The system controls the laser head to move toward the patient interface until the latter is centered on the optical axis.