The Earth behaves as though it has a magnet within it, due to the circulating currents inside its core. The Earth also produces a magnetic field, with the field lines being most concentrated at the poles.
If the Earth contained a large bar magnet, the south pole of that magnet would be near the geographic north, and the north pole of the magnet would be near the geographic south.
The Earth’s magnetic field is useful for navigating the planet. A compass, for example, has a magnetic needle that aligns with the Earth’s magnetic field. This needle, when allowed to pivot freely, points to the magnetic north, giving us a consistent reference direction for navigation.
Because opposite poles attract, the north pole of a compass is drawn to the Earth’s magnetic south pole. Since the Earth’s magnetic south pole is located near its geographic north pole, the north pole of a compass will point towards the geographic north.