Electrons posses a quantum mechanical property called spin. It is responsible for magnetism. It works when charge is moving. When charge does not flow there is no magnetic field. Magnetic fields work in a direction perpendicular to the flow of charge.

(should this even be in here?)

Sure, it's the easiest way to understand magnetism. We don't need to talk about the formulas associated with spin, we just need to give an overview of how it works.

(okay, perhaps we should lump this into an article about magnetism? Things are getting crowded in the main page)