NMR works by applying a strong magnetic field (the stronger the field the higher the resolution) to a sample and then observing how the system adsorbs radio waves (typically of frequencey between 4 and 900 MHz). The magnet serves to induce quantized energy levels within the nuclei being studied. These energy levels can then adsorb a specific frequency of electromagnetic radiation, resulting in a switch in the spin of the nucleus. NMR has been used to carry out quantum computation.
Electron Spin Resonance (ESR) operates on a the same principle, but uses the adsorption of microwaves by electrons within a strong magnetic field.