The light is emitted when fast-moving particles (electrons and protons) collide with atoms and molecules in Earth's atmosphere
The sudden flare-ups and rapid movement sometimes seen in the Northern and Southern Lights can now be explained in fine detail, say scientists.
They say the phenomenon is driven by huge releases of stored energy that occur more than 100,000km away in the Earth's protective magnetic shield.
The explosive events arise when stressed magnetic field lines suddenly snap to a new shape.
The information comes from five Nasa satellites flying around the Earth.
Details of the research have been published in the online journal Science Express.
"We discovered what makes the Northern Lights dance," explained Vassilis Angelopoulos of the University of California, Los Angeles, US.
The researcher is the lead scientist on the Themis (Time History of Events and Macroscale Interactions during Substorms) mission.
Themis was launched in early 2007
It used its quintet of widely separated, identical satellites, backed up by a network of ground stations, to trace the sequence of events from the initial trigger of what are termed substorms, through to their final outcome which are the spectacular displays of coloured light that flit across polar skies.
The observations confirm that the storms start with a so called "reconnection" in magnetic field lines.
"The Earth is bathed in the solar wind which carries with it the magnetic field of the Sun," explained Nicola Fox, a Johns Hopkins University scientist.
"The field can be in many directions but when it opposes Earth's magnetic field, just like two opposite poles of a magnet will attract, the two field lines will break and join together. This reconnection allows vast amounts of solar energy to enter into our own magnetosphere, generating a substorm which culminates in the formation of aurora."
The Themis observations show that a substorm starts to occur in a region of space about a third of the way to the Moon, and follows a particular pattern. This pattern consists of a period of reconnection, followed by rapid auroral brightening and rapid expansion of the aurora towards the poles. This culminates in a redistribution of the electrical currents flowing in space around Earth.
Understanding substorms is important because they can drive harmful high-energy particles into the near-Earth areas of space where astronauts and satellites operate. Huge currents can also get sent into the atmosphere to disrupt power lines and communications systems.
Scientists would like to be able to forecast potential problems earlier.