This paper proposes a robust control approach to achieve high-precision trajectory tracking for permanent magnet linear motor (PMLM) system containing uncertainties by describing the dynamic model of PMLM based on the Udwadia-Kalaba equation combined with constraint-following method. First, the system of PMLM is described as a constraint-following system by adding the generalized constraint force to the unconstrained Udwadia-Kalaba equation of PMLM system. Second, the robust constraint-following controller is designed based on the proposed model after uncertainty analysis. Moreover, the proposed controller is verified to guarantee deterministic performance for uncertain systems: uniformly bounded and uniformly ultimately bounded. Third, the numerical simulation and experimental validation demonstrate the effectiveness of proposed controller. Finally, the design approach of constraint-following can be applied to other systems with uncertainties.