The earliest form of compass was a naturally magnetic piece of lodestone used to indicate direction, which preceded the more advanced idea of using needles. They were used on land only and are described as south-pointing devices in a text dating from the 4th cent. BC.
Much later, between 850 AD and 1050, the needle compass came to be used for navigation at sea. At that time the Chinese established also that the needle always deviates slightly to the east, and does not point directly at the south, recognizing the shift of the magnetic field of the earth.
The first mention of the magnetic compass in European writings occuured in the year 1190, and it was not until the early fifteenth century that Europeans knew about the magnetic declination.