A compass is a magnetometer used for navigation and orientation that shows direction in regards to the geographic cardinal points.

The compass was invented more than 2000 years ago. The first compasses were made of lodestone, a naturally magnetized stone of iron, in Han dynasty China (20 BC – 20 AD). It was originally called the "South Pointing Fish" The compass was later used for navigation during the Chinese Song Dynasty (960–1279 AD), as described by Shen Kuo.

Later, compasses were made of iron needles, magnetized by striking them with a lodestone. Magnetized needles and compasses were first described in medieval Europe by the English theologian Alexander Neckam (1157–1217 AD).

More Info: en.wikipedia.org