SpaceX, the aerospace company founded by Elon Musk, has just completed a vital safety test of its new spaceship for NASA astronauts with flying colors - and a gigantic explosion.

Knowing that a dramatic fireball would result, SpaceX launched one of its Falcon 9 rockets on Sunday from Kennedy Space Center in Cape Canaveral, Florida. On top of the rocket was Crew Dragon: the company's new spaceship designed for NASA astronauts.

At exactly 84 seconds into the flight, when the rocket was traveling nearly twice as fast as the speed of sound, SpaceX cut the launch vehicle's nine engines.

SpaceX did this to simulate a launch failure, since demonstrating the ability of Crew Dragon to reach safety during such a failure is critical for SpaceX in working toward its first-ever launch of people into orbit.

An illustration of SpaceX's Crew Dragon spaceship for firing its engines during an abort from a Falcon 9 rocket launch.

So at the very moment SpaceX intentionally doomed its rocket, its new spaceship immediately detached and rocketed away to safety. Moments after that, the tumbling rocket succumbed to powerful aerodynamic forces, broke apart, and exploded into a brilliant orb-shaped fireball.

The space capsule landed in the ocean a few minutes later.

"Congratulations to the @NASA and @SpaceX team for a successful In-Flight Abort Test!" Jim Bridenstine, the agency's administrator, tweeted shortly after the mission. "This critical test puts us on the cusp of once again launching American astronauts on American rockets from American soil."

A critical rocket mission designed to fail

No people were on board during the flight: NASA and SpaceX commentators said during a live broadcast of the mission that two "crew simulators" (or crash-test mannequins) were buckled up inside.

As the rocket met its fiery demise, the Crew Dragon coasted to safety in an arc-shaped trajectory, somewhat like a football tossed high into the air.

At the pinnacle of its arc, which was predicted to be about 25 miles above the ground, the gumdrop-shaped Crew Dragon capsule shed its large cargo trunk, began falling back to Earth, and started positioning itself for a water landing.

At 4 minutes 45 seconds after launch, the Crew Dragon popped out two drogue parachutes. Less than a minute later, four large parachutes deployed and slowed down the space capsule. At almost exactly 9 minutes into the mission - just as a SpaceX animation of the in-flight abort test predicted - the Crew Dragon splashed into the Atlantic Ocean.

Recovery crews on ships are now working to recover the space capsule. The operation should last a couple of hours.

NASA and SpaceX plan to provide an update on the mission's status and brief the press at 12 p.m. ET, but it appears to have gone almost exactly as planned.