Earth's magnetic field makes a compass needle align roughly north-south. The magnetic field arises from the motion of molten iron in Earth's outer core, which is why compasses are so useful for navigation.
Fact 2 of 2⚡
Electricity can create magnetism
In 1820, Hans Christian Ørsted showed that a current-carrying wire deflects a nearby compass needle. This linked electricity and magnetism and laid the foundation of electromagnetism.