MRI, or magnetic resonance imaging, works by using a strong magnetic field and radio waves to generate images of the body's internal structures. MRI can be used to detect a variety of medical conditions and is particularly useful for soft tissue imaging.