SpaceX, Elon Musk’s spaceflight company, launched its Starship rocket from the coast of South Texas on Saturday, a mammoth vehicle that could alter the future of space transportation and help NASA return astronauts to the moon.

Saturday’s flight of Starship, a powerful vehicle designed to carry NASA astronauts to the moon, was not a complete success. SpaceX did not achieve the test launch’s ultimate objective — a partial trip around the world ending in a splashdown in the Pacific Ocean.

But the test flight, the vehicle’s second, did show that the company had fixed key issues that arose during the earlier test operation in April. All 33 engines in the vehicle’s lower booster stage fired, and the rocket made it through stage separation — when the booster falls away and the six engines of the upper stage light up to carry the vehicle to space.

“Just beautiful,” John Insprucker, a SpaceX engineer and live launch commentator, said on the SpaceX webcast.

By contrast, the first Starship launch badly damaged the launch site; several engines on the booster failed, fires knocked out the steering of the rocket and the flight termination system took too long to explode.

According to SpaceX’s “fail fast, learn faster” approach toward rocket design, successfully avoiding a repeat of past failures counts as major progress.

However, the second flight revealed new challenges that Mr. Musk’s engineers must overcome.

Soon after stage separation, the booster exploded — a “rapid unscheduled disassembly,” in the jargon of rocket engineers. The upper-stage Starship spacecraft continued heading toward orbit for several more minutes, reaching an altitude of more than 90 miles, but then SpaceX lost contact with it after the flight termination system detonated.

In a statement, the Federal Aviation Administration said no injuries or property damage had been reported. It will conduct a mishap investigation, which is standard any time something goes wrong with a commercial rocket.

Engineers will now have to decipher what went wrong on both the booster and the upper-stage spacecraft, make fixes and then try again.

Starship is the biggest and most powerful rocket ever to fly. SpaceX aims to make both parts of the vehicle fully and rapidly reusable. That gives it the potential to launch bigger and heavier payloads to space and to significantly drive down the cost of lofting satellites, space telescopes, people and the things they need to live into space.

The test journey’s outcome was the latest split-screen moment in the career of Mr. Musk, a serial entrepreneur who previously transformed electronic payments with PayPal and electric cars with Tesla. As SpaceX prepared for the flight on Friday, Disney and Apple paused their ad spending with another one of his companies, the social network X, formerly known as Twitter, after Mr. Musk’s endorsement of an antisemitic post on Wednesday.

Many outside observers are optimistic that SpaceX will get Starship to work fully.

“They have fixed issues identified in their first flight and got further than ever before with this type of vehicle,” said Phil Larson, who served as a White House space adviser during President Barack Obama’s administration and later worked on communication efforts at SpaceX. “The magic of engineering is that it is all about learning, iterating the design, and reflying again soon.”

Daniel L. Dumbacher, the executive director of the American Institute of Aeronautics and Astronautics, agreed. “This is a large launch system,” he said. “It’s going to take some work to get it to where it needs to go. I have no doubt that the SpaceX team will be able to figure out how to get the launch vehicle working.”

A couple of hours before sunrise on Saturday, liquid oxygen and liquid methane started flowing into the Starship. There was some fog near the ground but the skies above were clear, save for a few wisps of cirrus clouds.

The countdown proceeded smoothly, stopping at a planned hold with 40 seconds left on the countdown clock. Then the hold was lifted, the final seconds ticked away and, shortly after 7 a.m. Central time, the 400-foot-tall rocket slowly rose into the sky. A new water deluge system appears to have protected the launchpad, avoiding the cloud of dust and debris that rose up in April.

A few seconds later, the percussive roar buffeted spectators watching on South Padre Island, about five miles north of the launch site.

At 2 minutes, 48 seconds after liftoff, there was a flash as Starship successfully performed what had been expected to be the trickiest part of the flight — “hot staging,” when the six engines of the upper stage ignited before the booster dropped away. Loud cheers resonated from the SpaceX webcast, which was streaming from the company’s headquarters in Hawthorne, Calif.

Half a minute later, there was a bigger flash when the booster — which was to splash in the Gulf of Mexico and sink — exploded. The upper stage continued onward unscathed. But then a few minutes later, the webcast fell into an uncomfortable silence when contact was lost with the Starship vehicle.

Many of the thousands of people who woke up early to take in the launch on South Padre Island said they had enjoyed the spectacle. By 4:30 a.m., a long line of cars were waiting in darkness to enter Isla Blanca Park at the south end of the South Padre. Others walked from their hotels to avoid the traffic. Boats packed with watchers floated just to the south, outside of the exclusion zone to the east.

The launch was experienced not just by those watching along the coast, but also those farther afield.

Emma Guevara, a resident of Brownsville, the city in South Texas that is west of the SpaceX launch site, said the event had made her house shake.

“It was way earlier than we all expected, so it woke everyone up,” said Ms. Guevara, who is a Sierra Club organizer and has protested operations at the company’s base.

Top NASA officials offered congratulations to SpaceX.

“Each test represents a step closer to putting the first woman on the Moon with the #Artemis III Starship human landing system.,” Jim Free, NASA’s associate administrator for exploration systems development, wrote on X. “Looking forward to seeing what can be learned from this test that moves us closer to the next milestone.”

How quickly SpaceX solves the Starship issues could determine how soon NASA astronauts return to the moon.

The space agency has hired SpaceX to adapt Starship as a lunar lander to take two astronauts to the moon’s south polar regions. Even before the latest Starship test flight, the first landing, currently scheduled for late 2025, had already been considered likely to slip to 2026. SpaceX is also under contract to provide a Starship lander for the second crewed landing, scheduled for 2028.

For the moon landing, SpaceX would need not just one Starship but nearly 20 launches of the spacecraft, because a Starship headed to the moon would have to refill its propellant tanks before leaving Earth’s orbit.

For that, SpaceX is planning two other Starship variants.

One will essentially be an orbital gas station in space — a propellant depot in the language of space business. The other will be a tanker version to carry methane and liquid oxygen to the gas station. A series of tanker flights will be needed to fill the gas station. A Starship headed to the moon or Mars will launch and dock at the propellant depot and refill its tanks. But no one has yet tried pumping tons of propellants in a zero-gravity environment.

As a depot orbits Earth, it passes in and out of sunlight, and the outside of the depot will repeatedly warm and cool. Maintaining the propellants at steady, ultracold temperatures inside the depot will be a challenge.

At a meeting of a NASA Advisory Council committee on Friday, Lakiesha Hawkins, an assistant deputy associate administrator at NASA, said that the number of Starship launches would be in the “high teens.”

The Starships would launch “on a six-day rotation” from both the Kennedy Space Center in Florida and the current Starship launch site in Texas, Ms. Hawkins said.

NASA does have a backup. This year, it selected a second lunar lander design from Blue Origin — the rocket company based in Kent, Wash., started by Jeff Bezos, the founder of Amazon. That design is smaller and is planned for use in the third lunar landing, which will occur no earlier than 2029.

Ryan Mac and Katrina Miller contributed reporting.