Consider nuclei with a spin of one-half, like ,  or . Each nucleus has two linearly independent spin states, with m =  or m = − (also referred to as spin-up and spin-down, or sometimes α and β spin states, respectively) for the z-component of spin. In the absence of a magnetic field, these states are degenerate; that is, they have the same energy. Hence the number of nuclei in these two states will be essentially equal at thermal equilibrium.
If a nucleus is placed in a magnetic field, however, the two states no longer have the same energy as a result of the interaction between the nuclear magnetic dipole moment and the external magnetic field. The energy of a magnetic dipole moment  in a magnetic field B is given by: 
Usually the z-axis is chosen to be along B, and the above expression reduces to:
or alternatively:
As a result, the different nuclear spin states have different energies in a non-zero magnetic field. In less formal language, we can talk about the two spin states of a spin  as being aligned either with or against the magnetic field. If γ is positive (true for most isotopes used in NMR) then  is the lower energy state.
The energy difference between the two states is:
and this results in a small population bias favoring the lower energy state in thermal equilibrium. With more spins pointing up than down, a net spin magnetization along the magnetic field B results.