a compass is an instrument that tells us the directions. its needle, which has a magnet in it , spins freely whichever direction you are facing- but it will always settle down pointing to the north. the actual case of the magnetism has to do with the interior of the earth the centre of the earth has a molten metallic ironrich core that is spinning continously. it is believed that the metals in that core have many loosely bound electronsand that these particles can conduct electricity. it is this mass of movingelectrons which produces the magnetic field, which in turn, moves the needle of the compass.