NASA's Spitzer Space Telescope has spotted what it suspects is an asteroid smashup - the type of collision that can lead to the formation of new planets, according to a new study.

Scientists were already tracking the star, called NGC 2547-ID8, when they observed an eruption of dust and debris between August 2012 and January 2013.

"We think two big asteroids crashed into each other, creating a huge cloud of grains the size of very fine sand, which are now smashing themselves into smithereens and slowly leaking away from the star," lead author and graduate student Huan Meng of the University of Arizona, Tucson, said in a NASA news release.

While Spitzer has observed these kinds of dusty aftermaths before, this is the first time data was collected both before and after the collision - offering a glimpse into the formation of rocky planets such as Earth.

Asteroids start out as dusty material circling around young stars, which then smash into one another. But if they aren't destroyed during such violent collisions, after about 100 million years they can become fully-fledged terrestrial planets. Supposedly the Moon formed this way, the result of an impact between proto-Earth and a Mars-size object.

As for NGC 2547-ID8, which is about 35 million years old and lies 1,200 light-years away from Earth, previous observations had already recorded variations in the amount of dust around the star, hinting at possible ongoing asteroid collisions.

But in a dramatic turn of events, astronomers were astonished by what they saw.

"We are watching rocky planet formation happen right in front of us," said George Rieke from the University of Arizona and co-author of the new study. "This is a unique chance to study this process in near real-time."

The research team will continue to use Spitzer to monitor this star and its smashup spectacle, possibly hoping for another collision to take place. The results of this study were published in the journal Science.