1. The patient is placed in a strong magnetic field. This cause atomic nuclei within the body, which act like tiny spinning tops, to align themselves with the field.
2. MRI scanners are tuned to detect hydrogen nuclei, which are abundant in the tissue of the human body, in the form of water. A carefully chosen radiofrequency pulse is applied, which causes the hydrogen nuclei to flip over.
3. As they relax and right themselves again, the hydrogen nuclei emit radio signals at the same frequency as the pulse they just absorbed, a phenomenon called nuclear magnetic resonance.
4. The resonance frequency depends on the strength of the applied mmagnetic field. When precisely controlled variations are introduced into the magnetic field, the intensity of the resonance signals indicate the quantity of hydrogen nuclei in a particular location. By applying gradients into these dimensions, it is possible to determine the distribution of hydrogen nuclei within a particular region.
This process is repeated to build up a scan in which different types of tissues can be distinguished, since the proportion of water, and therefore of hydrogen nuclei, varies from one kind of tissue to another. 

Read more: MRI's inside story, The Economist