MRI uses a strong magnetic field to align the protons in the body's tissues. When these protons are exposed to a pulse of radio waves, they are knocked out of alignment. As they return to their original positions, they emit signals that are detected by the MRI machine. These signals are then processed by a computer to create detailed images of the body's internal structures.