SpaceX's Falcon 9 rocket carrying the Crew Dragon capsule lifts off from launch complex 39A at the Kennedy Space Center in Florida. [AFP]

Two veteran NASA astronauts were headed for the International Space Station on Saturday after Elon Musk's SpaceX became the first commercial company to launch a rocket carrying humans into orbit, ushering in a new era in space travel.

SpaceX's two-stage Falcon 9 rocket with astronauts Robert Behnken and Douglas Hurley aboard blasted off flawlessly in a cloud of bright orange flames and smoke from Florida's Kennedy Space Center for a 19-hour voyage to the space station.

"Let's light this candle," Hurley, the mission commander, told SpaceX mission control in Hawthorne, California, before liftoff at 3:22 pm (1922 GMT) from NASA's storied Launch Pad 39A.

The SpaceX launch is the first of American astronauts from US soil since the space shuttle program ended in 2011 and the first crewed flight ever by a private company.

"I'm really quite overcome with emotion," Musk said. "It's been 18 years working towards this goal.

"This is hopefully the first step on a journey towards civilization on Mars," the SpaceX founder said.

NASA administrator Jim Bridenstine said it was a "great day" for NASA and SpaceX and an "important milestone for the nation."

"We're not celebrating yet," Bridenstine cautioned. "We will celebrate when they're home safely."

In a brief interview from space, Hurley said that in keeping with the tradition of having astronauts name their spacecraft, he and Behnken had named the Crew Dragon capsule "Endeavour" after the retired space shuttle on which they both flew.

Behnken said the SpaceX capsule is a "lot different than its namesake" in that "it has touch display screens."

The mission, dubbed "Demo-2," ends a government monopoly on space flight and is the final test flight before NASA certifies SpaceX's capsule for regular crewed missions.

Behnken, 49, and Hurley, 53, former military test pilots who joined NASA in 2000, are scheduled to dock with the space station at 10:29 am (1429 GMT) on Sunday.

They will join US astronaut Chris Cassidy and Russian cosmonauts Anatoly Ivanishin and Ivan Vagner aboard the ISS.

NASA astronauts Bob Behnken (rear) and Doug Hurley are strapped in the SpaceX Crew Dragon capsule

'Special day'

SpaceX said Crew Dragon was on the correct trajectory to link up with the space station orbiting 250 miles (400 kilometers) above the Earth.

The reusable first booster stage of the Falcon 9 rocket separated cleanly about 2.5 minutes after liftoff and landed upright on a floating barge off the Atlantic coast. The second stage also separated smoothly.

The launch had originally been scheduled for Wednesday but was delayed because of weather conditions, which also remained uncertain on Saturday right up until liftoff.

The mission comes amid the coronavirus crisis and protests in multiple US cities over the death of a black man in Minneapolis while he was being arrested by a white police officer.

President Donald Trump flew to Florida to watch the launch and delivered remarks to NASA and SpaceX employees on what he called a "special day."

Trump first addressed the protests, saying he understood "the pain people are feeling" but that he would not tolerate "mob violence."

Trump praised Musk and said the launch "makes clear the commercial space industry is the future."

He also repeated his vow to send American astronauts back to the Moon in 2024 and eventually to Mars.

Behnken and Hurley blasted off from Launch Pad 39A, the same one used by Neil Armstrong on Apollo 11's 1969 journey to the Moon.

Defining moment for SpaceX

The pair, veterans of two space shuttle missions each, were in quarantine for more than two weeks ahead of the flight and were regularly tested for COVID-19.

They went through the same preparations Saturday that they went through on Wednesday, donning their futuristic SpaceX-designed spacesuits four hours before launch.

After saying goodbye to their wives -- both former astronauts -- they were driven to the launch pad in an electric car built by Tesla, one of Musk's other companies.

The Crew Dragon mission is a defining moment for SpaceX, which Musk founded in 2002 with the goal of producing a lower-cost alternative to human spaceflight.

The US space agency paid more than $3 billion for SpaceX to design, build, test and operate its reusable Dragon capsule for six future space round trips.

NASA has had to pay Russia for its Soyuz rockets to take US astronauts to space ever since the shuttle program ended.

SpaceX conducted a successful test flight of Crew Dragon to the ISS in March 2019 with a sensor-laden mannequin on board named Ripley, after the character played by Sigourney Weaver in the "Alien" movies.

The project has experienced delays, explosions, and parachute problems -- but even so, SpaceX has beaten its giant competitor Boeing to the punch.