Scott Carpenter, one of the original Mercury 7 astronauts and the second American to orbit the Earth in the early days of space travel, died Oct. 10 at a hospice in Denver. He was 88.

His wife, Patty Barrett, confirmed his death to the Associated Press, citing complications from a stroke.

Of the Mercury 7 crew, glorified by Life magazine and then immortalized anew in Tom Wolfe’s book “The Right Stuff,” only John Glenn, the retired senator from Ohio, survives.

Mr. Carpenter’s life had an unusual vertical dimension that extended from outer space to the depths of the ocean. His five-hour, three-orbit journey in space on May 24, 1962, was marred by a wildly off-course landing and a brief spasm of national anxiety in which Americans from President John F. Kennedy on down feared that he might have perished. He later battled suggestions that he’d been joyriding and had been complicit in overshooting his target.

Mr. Carpenter never flew in space again and instead went the other direction, becoming an aquanaut and devoting much of his energy to long-duration missions in undersea habitats.

American astronaut Lt. Col. John Glenn checks over notes with back-up pilot Scott Carpenter after a simulated flight, prior to the Mercury-Atlas 6 mission at Cape Canaveral, the object of which is to put the first American spaceman into orbit around the Earth. (Keystone/Getty Images)

Like his fellow astronauts in Project Mercury — Glenn, L. Gordon Cooper Jr., Virgil I. “Gus” Grissom, Walter M. Schirra Jr., Alan B. Shepard Jr. and Donald K. “Deke” Slayton — Mr. Carpenter became a national celebrity when he joined the NASA space-flight program in 1959.

It was Mr. Carpenter who uttered the famous line, “Godspeed, John Glenn,” when Glenn became the first American to orbit the Earth on Feb. 20, 1962. Mr. Carpenter became the second — and the fourth American in space — when he jumped ahead in the Mercury manifest after Slayton was forced to step aside because of a minor heart problem.

The mission didn’t attract the attention given to Glenn’s flight, and most Americans assumed that it would go as planned. Mr. Carpenter blasted off from Cape Canaveral, Fla., in a capsule named Aurora 7 perched on top of a Mercury-Atlas rocket. He raced to an altitude of 165 miles and circled the planet at 17,500 miles per hour.

“He was enjoying himself,” Tom Wolfe wrote. “He talked more, ate more, drank more water, and did more with the capsule than any of them ever had. He obviously loved all the experiments. He was swinging the capsule this way and that way, taking photographs a mile a minute, making detailed observations of the sunrises and horizon, releasing balloons, tending his bottles, taking readings with his densitometer, having a grand time.”

Mr. Carpenter also discovered the origin of the mysterious “fireflies” seen by Glenn during his earlier flight: When he inadvertently banged the hatch of the capsule he saw snowflakes fly by the window, and realized they came from the capsule and weren’t part of the space environment.

But things got dicey on the way home. Attitude-control equipment malfunctioned. The Aurora 7 ran low on fuel.

“Because of the loss of automatic control fuel, Carpenter was ordered rather sharply by Flight Director Christopher C. Kraft to fly his vehicle manually to conserve his automatic fuel, or face being told to end his journey after two orbits,” reported the next morning’s Washington Post.

Mr. Carpenter was a bit late firing his retro-rockets, and the capsule re-entered the atmosphere at too shallow of an angle. The radio blackout during re-entry lasted twice as long as expected, and for a few minutes everyone wondered if Aurora 7 and its pilot had survived the trip back to the surface.

Mr. Carpenter wound up more than 250 miles from the target splashdown area in the Atlantic, and for about 40 minutes no one knew where he was. Across America, people wondered: Would they find him?

Walter Cronkite reported on CBS News that America may have lost an astronaut.

An unidentified military pilot finally picked up the signal of an electronic beacon from Aurora 7. Twenty minutes later, the pilot said he could see the 37-year-old astronaut “sitting comfortably in his raft.”

After three hours in the raft, he was retrieved by the USS Intrepid.

“Carpenter Saved After 3 Orbits,” announced the front-page story in The Washington Post. Kennedy heaped praise on Mr. Carpenter for his courage and on the Navy for rescuing the wayward astronaut. In a phone call with the president, Mr. Carpenter apologized “for not having aimed a little bit better on re-entry.”

Mr. Carpenter was lionized like the other astronauts and received a medal and parades. The University of Colorado even awarded him a diploma that had been denied to him in 1949, when he left before completing a course on heat transfer. University President Quigg Newton said Mr. Carpenter’s “subsequent training as an astronaut has more than made up for his deficiency in the subject of heat transfer.”

But some people within the space program were less than thrilled with his performance, and the critics included Kraft, NASA’s flight director, who skewered Mr. Carpenter years later in a memoir. In 2001, responding to a book review of Kraft’s memoir, Mr. Carpenter wrote a letter to the New York Times defending his 1962 performance:

“The flight plan . . . called for a number of radical space maneuvers, more photography, more observation and some experiments, all of which I accomplished, in addition to returning safely to earth with the capsule unharmed. These facts alone should be enough to vindicate the flight of Aurora 7,” he wrote.

“[T]he system failures I encountered during the flight would have resulted in loss of the capsule and total mission failure had a man not been aboard. My postflight debriefings and reports led, in turn, to important changes in capsule design and future flight plans.”

Malcolm Scott Carpenter was born May 1, 1925, in Boulder, Colo. After his parents’ divorce when he was 3, he grew up primarily in the home of his grandfather, a Boulder newspaper editor.

He attended the University of Colorado, where he enrolled in the Navy’s flight training program and studied aeronautical engineering. He fell one course requirement short of earning a diploma, re-entered the Navy in 1949 and served in the Korean War. After training as a test pilot and serving as an intelligence officer, he was picked to be an astronaut in Project Mercury, a job that required not only aeronautical derring-do but an arduous journey through the public-relations machinery of NASA.

After his space flight, Mr. Carpenter joined the Navy’s Man-in-the-Sea program and spent 30 days underwater in 1965 in a Navy vessel called SeaLab II. While 200 feet below the surface of the ocean, he spoke by phone to two fellow astronauts who were orbiting the Earth in a Gemini capsule. He retired from the Navy as a commander in 1969 and founded Sea Sciences, a venture capital firm, and worked closely with ocean explorer Jacques Cousteau.

His first three marriages, to Rene Louise Price, Maria Roach and Barbara Curtin, ended in divorce. Survivors include his fourth wife, Patty Barrett, and four children from his first marriage, two from his second and one from his third.

Mr. Carpenter wrote several books, including a 2003 autobiography, “For Spacious Skies: The Uncommon Journey of a Mercury Astronaut.”

In 1999, as part of a NASA oral history project, Mr. Carpenter reflected on his experience in zero gravity on that day in 1962: “You have to realize that my experience with zero G, although transcendent, and more fun than I can tell you about, was in the light of current spaceflight accomplishments, very brief. But it was the nicest thing that ever happened to me.”