A magnetic field is generated when electric charge carriers such as electrons move through space or within an electrical conductor. The geometric shapes of the magnetic flux lines produced by moving charge carriers (electric current) are similar to the shapes of the flux lines in an electrostatic field. But there are differences in the ways electrostatic and magnetic fields interact with the environment.
Electrostatic flux is impeded or blocked by metallic objects. Magnetic flux passes through most metals with little or no effect, with certain exceptions, notably iron and nickel. These two metals, and alloys and mixtures containing them, are known as ferromagnetic materials because they concentrate magnetic lines of flux. An electromagnet provides a good example. An air-core coil carrying direct current produces a magnetic field. If an iron core is substituted for the air core in a given coil, the intensity of the magnetic field is greatly increased in the immediate vicinity of the coil. If the coil has many turns and carries a large current, and if the core material has exceptional ferromagnetic properties, the flux density near the ends of the core (the poles of the magnet) can be such that the electromagnet can be used to pick up and move cars.
When charge carriers are accelerated (as opposed to moving at constant velocity), a fluctuating magnetic field is produced. This generates a fluctuating electric field, which in turn produces another varying magnetic field. The result is a "leapfrog" effect, in which both fields can propagate over vast distances through space. Such a synergistic field is known as an electromagnetic field. This is the phenomenon that makes wireless communications and broadcasting possible.