CAPE CANAVERAL, FLA. -- A rocket ship built by Elon Musk's SpaceX company thundered away from Earth with two Americans on Saturday, ushering in a new era in commercial space travel and putting the United States back in the business of launching astronauts into orbit from home soil for the first time in nearly a decade.

NASA's Doug Hurley and Bob Behnken rode skyward aboard a white-and-black, bullet-shaped Dragon capsule on top of a Falcon 9 rocket, lifting off at 3:22 p.m. from the same launch pad used to send Apollo crews to the moon a half-century ago. Minutes later, they slipped safely into orbit.

"Let's light this candle," Hurley said just before ignition, borrowing the historic words used by Alan Shepard on America's first human spaceflight, in 1961.

The two men are scheduled to arrive Sunday at the International Space Station, 250 miles above Earth, for a stay of up to four months, after which they will come home with a Right Stuff-style splashdown at sea, something the world hasn't witnessed since the 1970s.

The mission unfolded amid the gloom of the coronavirus outbreak, which has killed more than 100,000 Americans, and racial unrest across the U.S. over the case of George Floyd, the handcuffed black man who died at the hands of Minneapolis police.

NASA officials and others expressed hope the flight would lift American spirits and show the world what the U.S. can do.

“We are back in the game. It's very satisfying,” said Doug Marshburn, of Deltona, Florida, who shouted, “USA! USA!” as he watched the 260-foot rocket climb skyward.

SpaceX becomes the first private company to launch people into orbit, a feat achieved previously by only three governments: the U.S., Russia and China.

“This is something that should really get people right in the heart of anyone who has any spirit of exploration,” Musk, the visionary also behind the Tesla electric car company, said after liftoff, pounding his chest with his fist.

The flight also ended a nine-year launch drought for NASA. Ever since it retired the space shuttle in 2011, NASA has relied on Russian spaceships launched from Kazakhstan to take U.S. astronauts to and from the space station.

Over the past few years, NASA outsourced the job of designing and building its next generation of spaceships to SpaceX and Boeing, awarding them $7 billion in contracts in a public-private partnership aimed at driving down costs and spurring innovation. Boeing's spaceship, the Starliner capsule, is not expected to fly astronauts until early 2021.

NASA plans to rely in part on commercial partners as it pursues it next goals: sending astronauts back to the moon within a few years, and on to Mars in the 2030s.

At a post-liftoff rally held at NASA's massive 525-foot-high Vehicle Assembly Building, President Donald Trump commended Musk and proclaimed: “Today we once again proudly launch American astronauts on American rockets, the best in the world, from right here on American soil.”

He vowed the U.S. will be the first to land on Mars, promising a “future of American dominance in space.”

Vice-President Mike Pence, who also witnessed the launch, said that as the nation deals with the coronavirus and racial strife, “I believe with all my heart that millions of Americans today will find the same inspiration and unity of purpose that we found in those days in the 1960s” during Apollo.

The first attempt to launch the rocket, on Wednesday, was called off with less than 17 minutes to go in the countdown because of lightning. On Saturday, stormy weather threatened another postponement for most of the day, but the skies began to clear just in the time.

The astronauts set out for the launch pad in a gull-wing Tesla SUV after Behnken pantomimed a hug of his 6-year-old son, Theo, and said: “Are you going to listen to Mommy and make her life easy?” Hurley blew kisses to his 10-year-old son and wife.

Nine minutes after liftoff, the rocket's first-stage booster landed, as designed, on a barge a few hundred miles off the Florida coast, to be reused on another flight.

“Thanks for the great ride to space,” Hurley told SpaceX ground control. The two crewmates batted around a floating blue dinosaur plush toy doubling as a dragon, demonstrating that they had reached zero gravity.

SpaceX controllers at Hawthorne, California, cheered and applauded wildly, and NASA Administrator Jim Bridenstine declared: “This is everything that America has to offer in its purest form.”

Attendance inside Kennedy Space Center was strictly limited because of the coronavirus, and the crowd amounted to only a few thousand. By NASA's count, over 3 million viewers tuned in online.

Despite NASA's insistence that the public stay safe by staying home, spectators flocked to beaches and roads, some of them not wearing masks or keeping 6 feet from others.

Among the spectators was Neil Wight, a machinist from Buffalo, New York.

“With everything that's going on in this country right now, it's important that we do things extraordinary in life,” he said. “We've been bombarded with doom and gloom for the last six, eight weeks, whatever it is, and this is awesome. It brings a lot of people together.”

Hurley, a 53-year-old retired Marine, and Behnken, 49, an Air Force colonel, are veterans of two space shuttle flights each.

Because of the coronavirus, the astronauts were kept in quasi-quarantine for more than two months. The SpaceX technicians who helped them get into their spacesuits wore masks and gloves that made them look like black-clad ninjas. And the SpaceX controllers had masks and were seated far apart.

In keeping with Musk's penchant for futuristic flash, the astronauts wore angular white uniforms with black trim. Instead of the usual multitude of dials, knobs and switches, the Dragon capsule has three large touchscreens.

Once settled in orbit, Hurley disclosed that the capsule has been christened Endeavour, a storied name in the history of exploration, also given to one of the space shuttles.

SpaceX has been launching cargo capsules to the space station since 2012.

Under the new corporate-public model, aerospace companies design, build, own and operate spaceships, and NASA is essentially a paying customer on a list that could eventually include non-government researchers, artists and tourists. (Tom Cruise has already expressed interest.)

Saturday's mission is technically considered a test flight. The next SpaceX voyage to the space station, set for the end of August, will have a full, four-person crew: three Americans and one Japanese.

The first flight was originally targeted for around 2015. But the project encountered bureaucratic delays and technical setbacks. A SpaceX capsule exploded on the test stand last year. And Boeing's first Starliner capsule ended up in the wrong orbit and was nearly destroyed during a test flight in December.

For SpaceX and the future of public-corporate space exploration, the stakes on Saturday were extraordinarily high.

With the spaceship finally on its way, Musk got choked up talking about the weight of his responsibility for the astronauts' lives and their families and noted that the return to Earth is more dangerous in some ways than ascent, “so we don't want to declare victory yet.”

Still, Musk said he wasn't nervous about the launch on Saturday the way he was during the previous attempt.

“Today, I don't know, it felt like just the fates were aligned,” he said.

Associated Press writers Jill Colvin and Mike Schneider in Cape Canaveral, Fla., contributed to this report.