A bar magnet can be used to create a compass in order to find the west direction.
A compass is an instrument that is used to find direction. A compass is created by placing a lightweight magnet on a nearly frictionless pivot point. The magnet is generally called a needle. One end of the needle is often marked "N," for north, or colored in some way to indicate that it points toward north. West would be the direction that is perpendicular and to the left of the North needle.
A compass works because Earth is thought to have a gigantic bar magnet buried inside. Opposite poles of a magnet attract to one another; much like opposite charges of an atom attract to one another. Therefore, in order for the north end of the compass to point toward the North Pole, it is thought that Earth's buried bar magnet has its south end at the North Pole.
Earth's core of molten iron is thought to contribute to the magnetism of Earth. Convection caused by heat that radiates from the Earth's core, along with the rotation of the Earth, causes the liquid iron to move in a rotational pattern. It is believed that these rotational forces in the liquid iron layer lead to weak magnetic forces.