Spewing orange and blue flame against the dark sky, NASA's Morpheus lander flew more than 800 feet (244 meters) into the air during its first-ever night flight test at Florida's Kennedy Space Center late last month.

The robotic spacecraft — a prototype system for landing on other planets — successfully touched down about two minutes later in a zone scattered with boulders during the May 28 test, guided by nothing more than its hazard detection system. You can watch a video of the spectacular nighttime test here, courtesy of NASA.

While in mid-air, Morpheus scanned the landing site using three light detection and ranging (lidar) sensors. The robot found rocks as small as 1 foot (0.3 m) across while still 0.25 miles (0.4 kilometers) away from the site.

From there, the Morpheus lander made a 3D map on the fly and picked a safe spot to touch down, using Doppler lidar to precisely change its altitude and velocity.

The two-minute flight capped off nearly eight years of work by the team, said Eric Roback, the lead engineer for the lidar system at NASA's Langley Research Center in Hampton, Virginia.

"With this sensor we could even find the safest landing site in a pitch-black crater," Roback said in a statement.

"Once this technology goes into service, the days of having to land 20 or 30 miles (32 to 48 km) from where you really want to land for fear of the hazardous craters and rocks will be over," he added. "Then we can land near the truly interesting science and near the critical resources that will be needed for eventual colonization, and we can do it over and over again safely."

The latest test was Morpheus' 14th free flight to date. The spacecraft is not only capable of hovering in mid-air like a helicopter but can also zoom sideways across the sky in search of a landing spot.

According to NASA, the hazard avoidance technology that Morpheus demonstrated will be key to helping humans land in other locations in the solar system. The agency aims to get humans to a near-Earth asteroid by 2025, then on to the vicinity of Mars by the mid-2030s.

Follow Elizabeth Howell @howellspace, or Space.com @Spacedotcom. We're also on Facebook and Google+. Original article on Space.com.