A SpaceX capsule carrying two NASA astronauts has successfully landed off the coast of Florida, completing the first crewed splashdown in a US vehicle in 45 years and the first ever by a private company.

The SpaceX Crew Dragon Endeavour landed off the coast of Pensacola in the Gulf of New Mexico early on Monday morning, Australian time, returning two astronauts, Bob Behnken and Doug Hurley, to Earth after a visit to the International Space Station (ISS).

The Demo-2 mission launched at the end of May saw the two NASA astronauts travelling to the International Space Station (ISS) on a two-month test flight of the vehicle.

The spacecraft undocked from the ISS on Saturday and returned to Earth after a 21-hour overnight journey.

“On behalf of the SpaceX and NASA teams, welcome back to Planet Earth. Thanks for flying SpaceX,” mission control said.

The flight was the last test of whether SpaceX could transport human astronauts to and from orbit, something no private company has ever done before.

It followed an unpiloted test flight to the station last year.

SpaceX will now begin operational manned flights for NASA late next month. Along with Boeing, SpaceX is one of only two private companies to have landed huge contracts with NASA to fly astronauts to the ISS.

It’s the first time NASA has sent astronauts into space from US soil since it scrapped its shuttle program in 2011.

In the years since, it has used Russia to launch its astronauts into space.

The SpaceX Crew Dragon Endeavour was the first crewed splashdown in an American capsule in 45 years.

SpaceX founder Elon Musk tweeted his congratulations to the team on Monday.

“When space travel becomes as common as air travel, the future of civilisation will be assured,” Musk later tweeted.

The splashdown involved the SpaceX on-board thrusters and two sets of autonomous parachutes working to slow the capsule down from 28,100kms per hour in orbit to 563kph during atmospheric re-entry and just 24kph when it hit the water.

The tech company’s capsule’s outer shell effectively withstood temperatures of up to 19,000 degrees and maintained an internal temperature for the astronauts at 29 degrees.

The launch has been labelled as the start of a “new era in human spaceflight” by Bridenstine.

The spacecraft’s control panel consisted entirely of touchscreen displays, using products including Australia’s own Atlassian’s Jira, Bitbucket and Confluence, in its development cycles.

Once the capsule landed in the ocean, it was quickly swarmed by a number of private boats, looking to investigate the unique occurrence, Space.com reported.

“That was not what we were anticipating,” NASA administrator Jim Bridenstine said. “After they landed, the boats just came in. We need to do a better job next time for sure.”

SpaceX president Gwynne Shotwell said there will be better security next time to protect the capsule upon its return to Earth.

“The lesson learned here is that we probably needed more Coast Guard assets, and maybe more SpaceX and NASA assets as well,” Shotwell said. “This was a demonstration mission.

“This is the time that you go learn about these things, and we’ll certainly be better prepared next time.”

SpaceX is also looking to launch a mission to Mars after successfully completing a number of tests last year.

SpaceX prototype rocket Starhopper successfully completed a second test flight in August last year, climbing to the target height of 150m and hovering for nearly a minute before gently navigating back to the ground.

The company is hoping to eventually use its Starship mega-rocket to carry humans and cargo to the Moon and Mars.