The motion control of robot manipulators is a crucial problem concerning automatically controlled robots. In this work, the model predictive control method with an integral compensation (MPC-I), which compensates for the matched uncertainties due to unmodeled dynamics, is proposed to solve the trajectory tracking problem of robot manipulators in joint and task spaces. First, this paper decouples the joint variables of the robot manipulator using a computed torque control method. The MPC-I method is, thereafter, derived to realize the motion control of the robot manipulators in joint space. To realize the motion control of the robot manipulator in task space, the task space is, thereafter, converted into the joint space, in which the MPC-I method is executed, afterward, to control the robot. Furthermore, an MPC-I variation, in which the inverse kinematics is calculated indirectly, is proposed to achieve the motion control in task space. The novelty of this paper is to propose the MPC-I method and the method of converting task space to joint space with indirect inverse kinematics calculation. The former is suitable for the dynamic control of the robot manipulators in the joint space, and the latter can extend the MPC-I method to dynamic control in task space. To evaluate the performance of the proposed control method, motion control simulations are performed in the task and joint spaces, respectively. Simulation results and comparisons verify the effectiveness of the proposed control approach for the dynamic control of the UR5 robot manipulator. INDEX TERMS Model predictive control (MPC), motion control, robot manipulators, trajectory tracking.