Magnetism is caused by the movement of tiny electric charges within atoms. When these electric charges align in the same direction, a north pole and south pole are created. North poles attract south poles, while equal poles repel each other.
Atoms consist of small electrical charges called protons, neutrons and electrons. Protons are positive, neutrons are electrically neutral and electrons are negative. The electrons circle the neutrons and protons, and each has a certain amount of spin. In many atoms, the electrons spin in opposite directions, which means that the total amount of spin is cancelled out.
In magnetic materials, however, the electrons spin in the same direction, and the material has the potential to become magnetic. If a material such as this is placed near a magnetic object, the electrons become aligned with their north and south poles facing opposite directions. When this happens, the material becomes a magnet.
When a north pole and south pole have been created, the magnet can be used to attract other magnets. If a north pole is placed within the magnetic field of the south pole of another magnet, there is a force of attraction. Magnetic fields are the invisible area of influence of a magnet.