The electric field and the magnetic field are components of the electromagnetic field . A magnetic field is a field of force produced by moving electric charges , by electric fields that vary in time , and by the ` intrinsic ' magnetic field of elementary particles associated with the spin of the particle . There are two separate but closely related fields to which the name ` magnetic field ' can refer : a magnetic field and a magnetic field .