Compasses align with Earth's magnetic field, pointing north-south. The needle is a small magnet that can pivot freely, aligning with the much larger magnetic field of our planet.
Earth's magnetic poles are actually near the geographic poles, but not exactly.