How does a spinning electron produce a magnetic field?

I learned in my undergraduate physics class that atoms have magnetic fields produced by the orbit of electrons and the spin of electrons. I understand how an orbit can induce a magnetic field because a charge moving in a circle is the same as a loop of current.

What I do not understand is how a spinning ball of charge can produce a magnetic field. Can someone explain how spin works, preferably in a way I can understand?

-
I think everyone missed the point of this question. I think the more important thing is if electron spin can produce a magnetic field just as its alleged classical analogue (a spherical shell charge distribution) – user76187 Mar 25 '15 at 8:02

An electron is not a spinning ball of charge and the intrinsic spin of particles cannot be understood in such terms. Not only is it difficult to make sense of what it means for a pointlike particle to spin, but also when treating the electron as a spinning ball of charge one finds a value of the ratio between the magnetic moment and the angular momentum that is a factor $2$ too small.

To understand why a rotating charged ball generates a magnetic field, note that every charge on the ball will move in a circle, so there is in fact a current, and that current will generate a magnetic field.

-
I see. A point in space does not have a direction. That is why scientists assign some arbitrary vector like the dipole moment. – Tad May 6 '14 at 21:40
The dipole moment is not arbitrary, it is a measurable quantity. – Robin Ekman May 6 '14 at 21:44

There is no classical analogue to visualise what spin is. We found out from experiments that particles have an intrinsic property which we named spin which produces a magnetic moment. You cannot visualise it since fundamental particles are zero-dimensional points in space so the term "spinning around its axis" makes no physical sense.

Its a strictly observational effect which fits well with our mathematical models and explains a great range of phenomena in nature.

-

Electrons don't spin. It is just what they decided to call a certain intrinsic property. They could of called it the X factor or magnetic factor but they called it spin for some reason

-
IMO you also need to say that this property, when added to a particle's orbital angular momentum and summed over a closed system of particles, heeds the law of conservation of angular momentun. So, although I think your point that "don't get too hung up on the classical analogy" is an excellent one, things are not quite as arbitrary as one might read this answer. – WetSavannaAnimal aka Rod Vance Oct 18 '14 at 9:38

Another way to visualize electron spin is to consider the "Dirac Electron"

Dirac's one equation for a massive particle can be rewritten as two equations for two interacting massless particles, where the coupling constant of the interaction is the mass of the electron.

We can follow these rules and visualize a current loop capturing an orthogonal magnetic field. This way you can represent both electrons and anti-electrons as left or right handed particles. These particles can also exist as either up or down state relative to its environment.

These coupled spinors spin orthogonal to themselves. From the direction of spin, you can see there is no way to push the electron and anti-electron together without destroying them.

Also note, turning the inner (blue) loop 360 degrees, only turns the larger (red) loop 180 degrees leaving it upside down. You must turn another 360 degrees (720 total) before it is right side up.

-
Could you please draw a bigger version of the diagrams - I am finding it hard to see what they are saying. Also, you need to emphasise that they are only a geometrical analogy for the Dirac equation - but even so, I am sure there is a helpful answer there with a bit more description. – WetSavannaAnimal aka Rod Vance Oct 18 '14 at 9:30

Electron is not like a ball, as it has no volume at all. So it can not spin like a ball. Magnetic moment comes "as is" from quantum mechanics, which do not explain its nature.

-
This answer might be better if you could expand final sentence a bit more. – Kyle Kanos Dec 1 '14 at 17:25

I really like the explanation on or about 29:30 of this older video. He causes the electrons to start spinning around the torus with the magnet, trapping the magnetic field lines orthogonal to the spinning electrons.