The two main stability results for nearly
integrable Hamiltonian systems are revisited: Nekhoroshev theorem, concerning exponential lower bounds for the stability time (effective stability), and KAM theorem, concerning the preservation of a majority of the nonresonant invariant tori (perpetual stability). To stress the relationship between both theorems, a common approach is given to their proof, consisting of bringing the system to a normal form constructed through the Lie series method. The estimates obtained for the size of the remainder rely on bounds of the associated vectorfields, allowing to get the "optimal" stability exponent in Nekhoroshev theorem for quasiconvex systems. On the other hand, a direct and complete proof of the isoenergetic KAM theorem is obtained. Moreover, a modification of the proof leads to the notion of nearly-invariant torus, which constitutes a bridge between KAM and Nekhoroshev theorems.