The Starship, the most powerful rocket system ever built, was designed to send astronauts to the moon, Mars and beyond.
SpaceX launched the biggest and most powerful rocket ever built on Thursday.
Minutes after liftoff, however, the vessel exploded.
"As if the flight test was not exciting enough, Starship experienced a rapid unscheduled disassembly before stage separation," SpaceX tweeted after the explosion.
SpaceX claims success despite explosion
SpaceX founder Elon Musk congratulated the SpaceX team for "an exciting test launch" and said on Twitter — the social media platform that he bought for $44 billion — that he had "Learned a lot for next test launch in a few months."
This was the second liftoff attempt of the Starship spacecraft, after a first test flight was aborted on Monday due to an issue with a pressurization valve.
The spacecraft took off from Starbase, the SpaceX spaceport in Boca Chica, Texas. It was due to drop its first-stage Super Heavy booster into the Gulf of Mexico. The spacecraft will then continue eastward to complete a near-circle of the Earth before splashing down near Hawaii.
"With a test like this, success comes from what we learn, and today's test will help us improve Starship's reliability as SpaceX seeks to make life multi-planetary," SpaceX tweeted.
Kate Tice, a SpaceX quality systems engineer, said that clearing the launchpad tower "had been our only hope."
The entire flight had been expected to last just 90 minutes.
First human journey to the Moon since 1972
The 50-meter (164-foot) Starship spacecraft had been designed to carry crew and cargo and sits atop a 70-meter-tall first-stage booster rocket.
The spacecraft and rocket have never flown together, so the test flight had aimed to assess their performance in combination.
As part of the Artemis III mission, NASA has selected Starship to transport astronauts to the moon in late 2025, marking the first human journey there since the Apollo program concluded in 1972.
Compared to NASA's Space Launch System (SLS), which has been under development for over a decade, Starship is larger and more powerful, with the capability to lift more than 100 metric tons into orbit.
The primary objective of Starship is to make space travel more accessible and cost-effective.
Musk: It is 'possible' to become 'multi-planet species'
In the future, SpaceX intends to refuel the Starship spacecraft in orbit by using another Starship, allowing it to travel to Mars or beyond.
Billionaire Musk hailed what he described as a pivotal moment ahead of the launch.
"We are at this brief moment in civilization where it is possible to become a multi-planet species," he said. "That's our goal. I think we've got a chance."
He has set his sights on making Starship reusable and bringing down the price per flight to a few million dollars.