NMR relies on the

  •     magnetic field : constant magnetic field applied to force alignment (polarization) of the nuclear spins
  •     radio frequency radiation: pulse of radio frequency radiation perturbs the alignment of the nuclear spins in the magnetic field

So, a nucleus with spin enters the magnetic field and aligns itself within that field.
Radio frequency pulse is applied, perturbs the alignment, and the amount of energy absorbed by the nucleus corresponds to the difference in energy between the two alignments. This information is captured to produce an NMR spectrum.


Ref: https://socratic.org/questions/why-2-radiations-are-given-for-nmr-spectroscopy-explain-it-brifly?source=search