An electromagnet is a type of magnet in which the magnetic field is produced by an electric current. Electromagnets usually consist of wire wound into a coil. A current through the wire creates a magnetic field which is concentrated in the hole in the center of the coil. When you introduce the current, either from a battery or another source of electricity, it flows through the wire. This creates a magnetic field around the coiled wire, magnetizing the metal as if it were a permanent magnet