SpaceX has successfully completely a test of its prototype rocket at its highest altitude yet, as it looks towards a mission to Mars.

Starhopper, a prototype of Elon Musk’s space company’s new rocket, successfully completed its second test flight in Boca Chica in Texas.

The rocket climbed to its target height of 150m, hovered for nearly a minute and used its engine to gently navigate back down to a nearby landing pad on the ground.

The test was scheduled to take place a day earlier but was delayed at the last moment due to technical difficulties.

The launch was aiming to test the rocket’s ability to land and take off in a controlled way.

It marked the second use of SpaceX’s new Raptor engine, which will be used to power Starship, the rocket the company plans to send to Mars.

The 150m height limit was imposed by the US Federal Aviation Administration, which provided approval for the launch.

SpaceX also conducted two tests of the rocket in early April, but these involved Starhopper being tethered to the ground for safety reasons.

The first test launch of the rocket took place last month and saw it reach a height of only 18m off the ground.

The successful second test launch will also be the last for Starhopper, with Musk confirming on Twitter that the rocket will now be retired to act as a “vertical test stand” for the Raptor engine.

Starship is the mega-rocket that SpaceX hopes will eventually carry humans and cargo to the Moon and Mars. Starhopper served to test many of the components that will eventually be used on the Mars-bound rocket.

Starship will stand at about 55m high and will launch from the top of a large rocket booster, dubbed Super Heavy by the company.

Starhopper only had one Raptor engine, but the company aims to eventually have six of the engines on the Starship rocket.

SpaceX plans for three of these engines to be optimised to perform best within Earth’s atmosphere, while the rest will be better suited to the vacuum of space.

Musk also plans for the rocket to be able to return to Earth after reaching the other planets and moons.

“One day Starship will land on the rusty sands of Mars,” Musk tweeted.

SpaceX will now be turning its attention towards building two prototypes of the Starship rocket, which is currently taking place across two sites in Florida and Texas.

It comes as a SpaceX capsule carrying science experiments and other equipment has returned home after being sent to the International Space Station last month. The capsule landed in the ocean south-west of Long Beach, California overnight.

Starship won’t be the first thing Musk’s company has launched into space, after a cherry red Tesla was successfully fired into space from Florida early last year, as part of an effort to test a rocket’s capabilities.