The gravitationally coupled orbit–attitude dynamics of a rigid body in a J2 gravity field is a high-precision model for the spacecraft in the close proximity of a small spheroid celestial body, since the gravitational orbit–attitude coupling of the spacecraft is naturally taken into account in this model. A Hamiltonian structure-based feedback control law is proposed to stabilize relative equilibria of the rigid body in the J2 gravity field. The proposed stabilization control law is consisted of three parts: potential shaping, momentum control, and energy control. The potential shaping is used to modify the gravitational potential artificially so that the relative equilibrium is a minimum of the modified Hamiltonian. It is shown that the unstable relative equilibrium can always be stabilized in the Lyapunov sense by the potential shaping with sufficiently large feedback gains. Then the momentum control leads the motion to the same invariant manifold with the relative equilibrium, which is actually a momentum level set. The energy control introduces energy dissipation into the system and the motion will asymptotically converge to the minimum of the modified Hamiltonian on the invariant manifold, i.e., the relative equilibrium. The feasibility of the proposed stabilization control law is validated through numerical simulations. The control law can be implemented by the attitude control system and low-thrust engines onboard and the fuel consumption is reasonable. This Hamiltonian structure-based stabilization approach is applicable to non-canonical Hamiltonian systems commonly existing in the astrodynamics. Since the natural dynamical behaviors of the system is fully utilized, the proposed control law is very simple and is easy to implement autonomously with little computation in the space applications.