The Earth's magnetic field is generated by the movement of liquid iron and nickel in the outer core, a process known as the geodynamo. The inner core is solid, while the crust and mantle do not have the liquid metal flow necessary to generate this magnetic field.