The spinning of the electrons around the nucleus of an atom creates a tiny magnetic field. The electrons in most objects spin in random directions, and their magnetic forces cancel out each other.
Magnets are different, because the molecules in magnets are arranged so that their electrons spin in the same direction. This arrangement and movement creates a magnetic force that flows from a north-seeking pole and a south-seeking pole. The magnetic force creates a magnetic field around a magnet.
Have you ever held two magnets close to each other? They don't act like most objects. If you try to push the same poles together, they repel each other. But if you put different poles together, the magnets will stick together because the north and south poles are attracted to each other. Just like protons and electrons—opposites attract with magnets.
Magnetic fields can be used to make electricity
The properties of magnets can be used to make electricity. Moving magnetic fields can pull and push electrons. Metals such as copper have electrons that are loosely held, so the electrons in copper wires can easily be pushed from their shells by moving magnets.
By using moving magnets and copper wire together, electric generators create electricity. Electric generators essentially convert kinetic energy (the energy of motion) into electrical energy.