When new basalt forms along mid ocean ridges, they become magnetized according to the the earth's existing magnetic field. The magnetic minerals in basalt will align in the direction of the prevailing geomagnetic field of the earth.
The earth is like a bar magnet due to the magnetic field being produced by the movement of molten metallic materials in the outer core.
The effect of the magnetic field is felt globally as new magma are brought to the surface.
Magnetic minerals for example in basalt will align their domains in the direction of the existing or prevailing field.
This is used in studying paleomagnetism of a rock.