Earth very narrowly missed a catastrophic "solar superstorm" that would have seen satellites disabled, electronic devices disrupted and would have wreaked havoc on the electric grid.
According research published in Nature Communications, scientists at University of California, Berkeley, together with experts from China, have found Earth narrowly dodged a "huge magnetic bullet" in July 2012.
This was thanks to the Earth's position on the other side of the sun from where the eruptions took place.
The study looks at a rapid succession of coronal mass ejections from the Sun that sent a pulse of magnetised plasma towards Earth's orbit.
Had the eruptions taken place just nine days earlier, the effect on Earth would have been "tremendous", enveloping the planet in magnetic fireworks that match the largest magnetic storm ever recorded.
The storm would have matched the Carrington Event, which took place in 1859 and knocked out communication systems and power lines across the US. During the event, the Northern Lights were visible as far south as Hawaii.
One of the research leaders, Janet G Luhmann, said: "Had it hit Earth, it probably would have been like the big one in 1859, but the effect today, with our modern technologies, would have been tremendous."
Ying D Liu, National Space Science Center of the Chinese Academy of Sciences in Beijing, added: "An extreme space weather storm – a solar superstorm – is a low-probability, high-consequence event that poses severe threats to critical infrastructures of the modern society. The cost of an extreme space weather event, if it hits Earth, could reach trillions of dollars with a potential recovery time of four to 10 years.
"Therefore, it is paramount to the security and economic interest of the modern society to understand solar superstorms."
Last year, a study estimated the cost of a magnetic storm similar to the Carrington Event would cost $2.6tn (£1.5tn) worldwide.
In their study, the researchers found that a huge coronal mass ejection on 22 July propelled a magnetic cloud towards Earth at 2,000km/s, four times faster than a normal magnetic storm.
Luckily, the Earth and other planets were on the other side of the Sun at the time of the eruption, however. The team found that the solar superstorm was from two simultaneous coronal mass ejections that released the energy equal to a billion hydrogen bombs.
Luhmann said: "Some of us wish Earth had been in the way; what an experiment that would have been."
Discussing solar events such as these, she added: "People keep saying that these are rare natural hazards, but they are happening in the solar system even though we don't always see them. It's like with earthquakes – it is hard to impress upon people the importance of preparing unless you suffer a magnitude nine earthquake."