In this paper, the notion of contraction is used to solve the trajectory-tracking problem for a class of mechanical systems. Additionally, we propose a dynamic extension to remove velocity measurements from the controller while rejecting matched disturbances. In particular, we propose three control designs stemming from the Interconnection and Damping Assignment Passivity-Based Control approach. The first controller is a tracker that does not require velocity measurements. The second control design solves the trajectory-tracking problem while guaranteeing robustness with respect to matched disturbances. Then, the third approach is a combination of both mentioned controllers. It is shown that all proposed design methods guarantee exponential convergence of the mechanical system to the desired (feasible) trajectory due to the contraction property of the closed-loop system. The applicability of this method is illustrated via the design of a controller for an underactuated mechanical system.