Electromagnets work by utilizing a combination of electricity and magnetism. In an electromagnet, the magnetic field is produced by an electric current, which then disappears when the magnet is turned off. Through controlled use of electricity, an electromagnet is capable of attracting and holding ferrous materials such as heavy iron, scrap steel, and more.