This paper deals with a class of controlled mechanical systems in which the number of control inputs, equal to the number of desired system outputs, is smaller than the number of degrees of freedom. The related inverse dynamics control problem, i.e., the determination of control input strategy that force the underactuated system to complete the partly specified motion, is a challenging task. In the present formulation, the desired system outputs, expressed in terms of the system states, are treated as servo-constraints on the system, and the problem is viewed from the constrained motion perspective. Mixed orthogonal-tangent realization of the constraints by the available control reactions is stated, and a specialized methodology for solving the "singular" control problem is developed. The governing equations are manipulated to index three differential-algebraic equations, and a simple numerical code for solving the equations is proposed. The feedforward control law obtained as a solution to these equations can then be enhanced by a closed-loop control strategy with feedback of the actual servo-constraint violations to provide stable tracking of the reference motion in the presence of perturbations and modeling uncertainties. An overhead trolley crane executing a load-prescribed motion serves as an illustration. Some results of numerical simulations are reported.