A ferromagnetic vehicle, such as a submarine, magnetized by the Earth’s magnetic field produces a magnetic anomaly field, and the tracking of moving targets can be realized through real-time analysis of magnetic data. At present, there are few tracking methods based on magnetic field vectors and their gradient tensor. In this paper, the magnetic field vector and its gradient tensor are used to calculate equivalent magnetic force. It shows the direction of the vector between the detector and the tracking targets for controlling the direction of motion of the detector and achieving the purpose of tracking. Compared with existing positioning methods, the proposed method is relatively less affected by instrument resolution and noise and maintains robustness when the velocity vectors of multiple magnetic targets change randomly.