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 magnetic compass is the oldest instrument for navigation and has been a vital tool for navigators at sea for centuries. No matter where you stand on the earth, you can hold a compass in your hand and it will point towards the north pole. This is because the earth has a magnetic field and the pointer is also magnetic. The pointer thus aligns itself with the magnetic poles of the earth.