How does Earth’s magnetic field make a compass needle point north and south?
Earth acts as an enormous bar magnet with a north-south magnetic field generated by electric currents within its liquid core. A magnetic compass needle is itself a small magnet, or magnetic dipole, that is free to rotate on a pivot.1234
When placed within Earth’s magnetic field, the needle experiences a torque that acts to align its own magnetic moment with the external field lines. Because the needle is a magnet, it naturally seeks the orientation of lowest potential energy, where its magnetic moment is aligned with the direction of the field.4
Consequently, the needle rotates until it points along the magnetic field lines, which run generally north-south. It is important to note that because opposite magnetic poles attract, the end of the compass needle marked "N" (north) is actually attracted to the Earth's magnetic south pole, which is located near the geographic North Pole.24