A rapid succession of coronal mass ejections the most intense eruptions on the Sun sent a pulse of magnetised plasma barrelling into space and through Earth's orbit, said researchers.
Had the eruption come nine days earlier, when the ignition spot on the solar surface was aimed at Earth, it would have hit the planet, potentially wreaking havoc with the electrical grid, disabling satellites and Global Positioning System, and disrupting our increasingly electronic lives.
The solar bursts would have enveloped Earth in magnetic fireworks matching the largest magnetic storm ever reported on Earth, the so-called Carrington event of 1859, researchers said.
The dominant mode of communication at that time, the telegraph system, was knocked out across the US literally shocking telegraph operators. Meanwhile, the Northern Lights lit up the night sky as far south as Hawaii.
"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," said Janet G Luhmann from the University of California, Berkeley
A study last year estimated that the cost of a solar storm like the Carrington Event could reach USD 2.6 trillion worldwide, researchers said.
"An extreme space weather storm a solar super-storm is a low-probability, high-consequence event that poses severe threats to critical infrastructures of the modern society," said Ying D Liu, from China's State Key Laboratory of Space Weather.
"The cost of an extreme space weather event, if it hits Earth, could reach trillions of dollars with a potential recovery time of 4-10 years. Therefore, it is paramount to the security and economic interest of the modern society to understand solar super-storms," said Liu.
Based on their analysis of the 2012 event, Liu, Luhmann and their colleagues concluded that a huge outburst on the Sun on July 22 propelled a magnetic cloud through the solar wind at a peak speed of more than 2,000 kilometres per second four times the typical speed of a magnetic storm.
It tore through Earth's orbit but, luckily, Earth and the other planets were on the other side of the Sun at the time.
Any planets in the line of sight would have suffered severe magnetic storms as the magnetic field of the outburst tangled with the planets' own magnetic fields.
Researchers determined that the huge outburst resulted from at least two nearly simultaneous coronal mass ejections (CMEs), which typically release energies equivalent to that of about a billion hydrogen bombs.
The study was published in the journal Nature Communications.