The paper deals with a novel control algorithm for simultaneous stabilization and trajectory tracking of underactuated nonlinear mechanical systems (UNMS) with included actuators dynamics. Simultaneous stabilization and trajectory tracking refer to arbitrary chosen actuated and unactuated degrees of freedom (DOF) of the system. The proposed control approach can be applied both to the second-order nonholonomic systems and the systems with input coupling, while a general model of actuators dynamics includes electrical, pneumatic, and hydraulic drives. Control law is based on linear combination of two control signals, where the first signal is designed to separately control only actuated DOF, and second to separately control only unactuated DOF. Simulation example of rotational inverted pendulum driven by electrical DC motor is presented, showing the effectiveness of the proposed approach.