As the magma cools to form new crust, its iron-bearing minerals magnetise and "fix" in the direction of the prevailing magnetic field.
(the magma cools; to form; new crust) (its iron-bearing minerals; magnetise; ) (its iron-bearing minerals; fix; )
the magma cools its iron-bearing minerals its iron-bearing minerals
to form magnetise fix
new crust