how does a compass work
A compass works because the pointer works as a magnet. The pointer is attracted to the magnetic fields and is generally set to point to the North.
A compass works by showing what direction is the magnetic north. One can then determine what their position is relative to the magnetic north.