A compass has a small balanced pointer that always points North-South. This is because:
The earth has a magnetic field and the pointer is magnetic
The earth behaves as a big magnet with its south pole located near the geographical north pole and vice versa. Since, like poles attract and unlike repel, when a magnet is suspended freely, the north pole of the magnet will point towards south pole of the earth's magnet which is located near the geographical north pole.