In this paper, a nonlinear model predictive swing-up and stabilizing sliding controller is proposed for an inverted pendulum-cart system. In the swing up phase, the nonlinear model predictive control is formulated as a nonlinear programming problem with energy based objective function. By solving this problem at each sampling instant, a sequence of control inputs that optimize the nonlinear objective function subject to various constraints over a finite horizon are obtained. Then, this control drives the pendulum to a predefined neighborhood of the upper equilibrium point, at where sliding mode based model predictive control is used to stabilize the systems with the specified constraints. It is shown by the simulations that, due to the way of formulating the problem, short horizon lengths are sufficient for attaining the swing up goal.