Pointing North
The needle of a compass is a small magnet, one that is allowed to pivot in the horizontal plane. The needle experiences a torque from the ambient magnetic field of the Earth. The reaction to this torque is the needle's preferred alignment with the horizontal component of the geomagnetic field. The 'north' end of the compass needle is simply the north end of the magnet, and it is the end of the compass needle that points in the general direction of the geographic north pole; naturally, the 'south' end of the compass needle is the south end of the magnet and it points in the opposite direction, towards the general direction of the geographic south pole. Having said this, the preferred directionality of a compass can be affected by local perturbations in the magnetic field, like those set up by (say) a near-by electrical system; a compass can also be affected by local magnetization of the Earth's crust, particularly near large igneous or volcanic rock deposits.
At most places on the Earth's surface, the compass doesn't point exactly toward geographic north. The deviation of the compass from true north is an angle called 'declination'. It is a quantity that has been a nuisance to navigators for centuries, especially since it varies with geographic location. It might surprise you to know that at very high latitudes the compass can even point south! Declination is simply a manifestation of the complexity of the geomagnetic field. The field is not perfectly symmetrical, it has non-dipolar 'ingredients', and the dipole itself is not perfectly aligned with the rotational axis of the Earth.
Interestingly, if you were to stand at the north geomagnetic pole, your compass, held horizontally as usual, would not have a preference to point in any particular direction, and the same would be true if you were standing at the south geomagnetic pole. Moreover, if you were to hold your compass on its side the north-pointing end of the compass would point down at the north geomagnetic pole, and it would point up at the south geomagnetic pole.
Fact Credit
USGS General