Magnets align themselves according to the strongest magnet around them.
Magnets align themselves to the strongest magnet around them. A magnet, when suspended freely, aligns itself to according to the earth's magnetic field. This is because the south pole of the magnet is attracted by the earth's magnetic north pole(geographical south) and the north pole of the magnet is attracted by earth's magnetic south pole(geographical north).