A new robust controller using sliding mode control method for a class of underactuated mechanical systems with mismatched uncertainties is proposed in this paper. Two state variables of the underactuated system are chosen to construct the first-layer sliding surface. The first-layer sliding surface and one of the left state variables are used to construct the second-layer sliding surface. This process continues till the last sliding surface is constructed. And a distributed compensator is added to the sliding mode surfaces. We design a new sliding mode control law to guarantee that every sliding surface can converge rapidly to zero. For an underactuated system, which consists of 2n state variables, the controller has the (2n-1)-layer structure. Using Lyapunov law, we prove the stability of all the sliding surfaces theoretically. The simulation results show the validity of this method.