This paper studies the stabilization problem for a class of underactuated systems in the presence of unknown disturbances. Due to less number of control inputs with respect to the degrees of freedom of the system, closed-loop asymptotic stability is a challenging issue in this field. In this paper, anti-swing controllers are designed for nominal and disturbed systems. In the case of the nominal system, the proposed two-loop controller is a combination of collocated partial feedback linearization and hierarchical sliding mode control (HSMC) theories. Then, due to the importance of robustness in control of physical systems, the proposed controller is developed for underactuated mechanical systems in the presence of additive disturbances. One of the main advantages of the proposed design method is that it does not need any switching algorithm. Finally, to illustrate the performance of the proposed controllers, they are applied to two underactuated mechanical systems: a pendubot and a Furuta pendulum. In addition, the practicality of the proposed approach is also verified experimentally using a quadrotor stand.