1. Iron-rich magma heats up inside Earth. 2. Convection currents form, cycling magma between the core and the crust. 3. A continuous flow of liquid iron creates electric currents inside Earth. 4. The electric currents create a magnetic field around Earth.