Magnetism is caused by the alignment of atoms' spins and orbits within materials like iron, nickel, and cobalt. Magnetic fields are produced by moving electric charges. In magnetic materials, the atomic spins and orbits align into regions called domains that can be oriented by an external magnetic field. Electric currents produce magnetic fields, and changing magnetic fields induce electric currents based on Faraday's law of induction. This principle is exploited in devices like generators, transformers, and motors.