The objective of this paper is to study the tidally locked 3:2 spin–orbit resonance of Mercury around the Sun. In order to achieve this goal, the effective potential energy that determines the spinning motion of an ellipsoidal planet around its axis is considered. By studying the rotational potential energy of an ellipsoidal planet orbiting a spherical star on an elliptic orbit with fixed eccentricity and semi-major axis, it is shown that the system presents an infinite number of metastable equilibrium configurations. These states correspond to local minima of the rotational potential energy averaged over an orbit, where the ratio between the rotational period of the planet around its axis and the revolution period around the star is fixed. The configurations in which this ratio is an integer or an half integer are of particular interest. Among these configurations, the deepest minimum in the average potential energy corresponds to a situation where the rotational and orbital motion of the planet are synchronous, and the system is tidally locked. The next-to-the deepest minimum corresponds to the case in which the planet rotates three times around its axis in the time that it needs to complete two orbits around the Sun. The latter is indeed the case that describes Mercury’s motion. The method discussed in this work allows one to identify the integer and half integer ratios that correspond to spin-orbit resonances and to describe the motion of the planet in the resonant orbit.