Magnetic fields are produced by changing electric fields, usually moving charges such as electrons, often the form of a macroscopic current (like the current in a wire) or a microscopic current (such as in an atomic orbit). In one of the most beautiful examples of symmetry in physics, changing magnetic fields create electric fields. These electric fields that come from changing magnetic fields are how electric generators can create electric current.
A magnetic field is a vector field, meaning it has a specified magnitude and direction at any point. The SI unit of magnetic field is the Tesla (T) in honor of physicist Nikola Tesla, with units of N/A·m. The Tesla is a huge unit, with a 1 T magnetic field being quite large. A smaller unit the Gauss (after the great physicist/mathematician Carl Friedrich Emmanuel Gauss) it one ten thousandth of a Tesla. The magnetic field of the Earth is roughly 1 Gauss but it varies depending on where the measurement is taken.
Magnets are materials that have a magnetization caused by microscopic properties of atoms, and the magnetic field they give off is characterized by their north and south poles. The direction of these magnetic fields always points from the north pole to the south pole. This convention can be used to determine the force the magnet will apply on a charge, and how one magnet will interact with other magnets.
Magnetic fields are different from electric fields and gravitational fields, in that the force they apply on an object is not parallel to the field. A magnetic field actually acts perpendicular to a moving charge in its presence. To learn more about how this force is applied to a moving charge, visit hyperphysics.
Figure 2: The magnetic field lines from a North-South interaction of magnetic fields.
Figure 3: The magnetic field lines from a repelling magnetic interaction (North-North or South-South)
The Earth has its own magnetic field, which was originally thought to be from its iron composition in the core, but is now surmised to be created by circulating electric currents in the liquid core. The magnetic field of the Earth protects life from harmful solar winds from the Sun, whose charged particles would otherwise strip away the ozone layer that protects the Earth from harmful ultraviolet radiation (shown in Figure 4). The interaction of the Earth's magnetic field and solar wind produces the well-known phenomena of the Auroras, shown in Figure 5.
Figure 4: The magnetic field of the Earth protects the planet from harsh solar winds. Note the Earth-sun distance is not to scale in this image, the Earth is much farther away from the sun than this picture implies.
Figure 5: Aurora Borealis, a product of the interaction of the Earth's magnetic field and solar wind.
Although it is logical to assume that the North and South Pole on the Earth represent the North and South poles of a very large bar magnet, this is not the case. The north pole is the direction that the north end of a compass points. What people on Earth generally refer to as the North Pole in the geographic sense is actually the magnetic south pole, and vice versa. This means that if a compass needle is pointing towards the geographic North Pole of the Earth, the compass needle is aligned with the south magnetic pole.