1) The Earth behaves like a giant bar magnet with magnetic north and south poles. Its magnetic field is generated by electrical currents in the liquid outer core due to convection of iron and nickel.
2) The magnetic poles do not align with the geographic poles, as the magnetic axis is tilted about 11 degrees from the Earth's rotational axis.
3) The dynamo effect in the outer core sustains the Earth's magnetic field through convection-driven electrical currents that act like a self-exciting dynamo.