CAPE CANAVERAL, Fla. (AP) — A NASA spacecraft designed to burrow beneath the surface of Mars landed on the red planet Monday after a six-month, 300 million-mile (482 million-kilometer) journey and a perilous, six-minute descent through the rose-hued atmosphere.

Flight controllers at NASA's Jet Propulsion Laboratory in Pasadena, California, leaped out of their seats and erupted in screams, applause and laughter as the news came in. People hugged, shook hands, exchanged high-fives, pumped their fists, wiped away tears and danced in the aisles.

"Flawless," declared JPL's chief engineer, Rob Manning.

"This is what we really hoped and imagined in our mind's eye," he said. "Sometimes things work out in your favor."

A pair of mini satellites trailing InSight since their May liftoff provided practically real-time updates of the spacecraft's supersonic descent through the reddish skies. The satellite also shot back a quick photo from Mars' surface.

The image was marred by specks of debris on the camera cover. But the quick look at the vista showed a flat surface with few if any rocks — just what scientists were hoping for. Much better pictures will arrive in the hours and days ahead.

"What a relief," Manning said. "This is really fantastic." He added: "Wow! This never gets old."

The three-legged InSight spacecraft reached the surface after going from 12,300 mph (19,800 kph) to zero in six minutes flat, using a parachute and braking engines to slow down. Radio signals confirming the landing took more than eight minutes to cross the nearly 100 million miles (160 million kilometers) between Mars and Earth.

It was NASA's ninth attempt to land at Mars since the 1976 Viking probes. All but one of the previous U.S. touchdowns were successful.

NASA last landed on Mars in 2012 with the Curiosity rover.

Viewings were held coast to coast at museums, planetariums and libraries, as well as New York's Times Square.

"Landing on Mars is one of the hardest single jobs that people have to do in planetary exploration," InSight's lead scientist, Bruce Banerdt, said before the landing. "It's such a difficult thing, it's such a dangerous thing that there's always a fairly uncomfortably large chance that something could go wrong."

Mars has been the graveyard for a multitude of space missions. Up to now, the success rate at the red planet was only 40 percent, counting every attempted flyby, orbital flight and landing by the U.S., Russia and other countries since 1960.

The U.S., however, has pulled off seven successful Mars landings in the past four decades, not counting InSight, with only one failed touchdown. No other country has managed to set and operate a spacecraft on the dusty red surface.

InSight was shooting for Elysium Planitia, a plain near the Martian equator that the InSight team hopes is as flat as a parking lot in Kansas with few, if any, rocks.

This is no rock-collecting expedition. Instead, the stationary 800-pound (360-kilogram) lander will use its 6-foot (1.8-meter) robotic arm to place a mechanical mole and seismometer on the ground. The self-hammering mole will burrow 16 feet (5 meters) down to measure the planet's internal heat, while the seismometer listens for possible quakes.

Nothing like this has been attempted before at our next-door neighbor, nearly 100 million miles (160 million kilometers) away. No lander has dug deeper than several inches, and no seismometer has ever worked on Mars.

By examining the interior of Mars, scientists hope to understand how our solar system's rocky planets formed 4.5 billion years ago and why they turned out so different — Mars cold and dry, Venus and Mercury burning hot, and Earth hospitable to life.

InSight has no life-detecting capability, however. That will be left to future rovers. NASA's Mars 2020 mission, for instance, will collect rocks that will eventually be brought back to Earth and analyzed for evidence of ancient life.