US astronaut John Young, who flew to the moon twice and commanded the first ever space shuttle mission, has died aged 87.
"Today, NASA and the world have lost a pioneer," the US space agency chief, Robert Lightfoot, said in a statement.
Mr Young was the only person to have flown missions on the Gemini, Apollo and space shuttle programmes.
He also once famously smuggled a corned beef sandwich on to a space flight as a gift for a fellow astronaut.
Mr Young retired in 2004 after a 42-year career. NASA said he died on Friday following complications from pneumonia.
We're saddened by the loss of astronaut John Young, who was 87. Young flew twice to the Moon, walked on its surface & flew the first Space Shuttle mission. He went to space six times in the Gemini, Apollo & Space Shuttle programs. pic.twitter.com/l4nSwUCMIq— NASA (@NASA) January 6, 2018
"John was one of that group of early space pioneers whose bravery and commitment sparked our nation's first great achievements in space," Mr Lightfoot said.
"But, not content with that, his hands-on contributions continued long after the last of his six space flights - a world record at the time of his retirement from the cockpit."
Born in San Francisco in 1930, John Young gained a degree in aeronautical engineering at the Georgia Institute of Technology and then served in the US Navy as a test pilot.
He was picked as a NASA astronaut in 1962 and first went into space in 1965 with the Gemini 3 mission.
It was while orbiting the Earth that he handed the smuggled sandwich to his colleague, Gus Grissom. NASA later rebuked him for the stunt.
In May 1969 Mr Young was part of the Apollo 10 mission that flew to the moon as a rehearsal for the Apollo 11 landing two months later. The crew tested the lander module in lunar orbit without landing it.
John Young finally walked on the moon himself in 1972 as commander of the Apollo 16 mission - the ninth of 12 people to have ever set foot on the lunar surface.
He and crewmate Charles Duke gathered rock and soil samples and drove the lunar rover more than 26km.
In an interview with the Houston Chronicle in 2004, Mr Young recalled: "One-sixth gravity on the surface of the moon is just delightful. It's not like being in zero gravity, you know. You can drop a pencil in zero gravity and look for it for three days. In one-sixth gravity, you just look down and there it is."
In 1981, Mr Young commanded the inaugural flight of NASA's first space shuttle, Columbia. Two years later he became the first person to fly six space missions when he commanded Columbia on the first Spacelab mission.
It was his last journey into space. John Young had been due to command a space shuttle flight in 1986 but it was cancelled after the explosion of the shuttle Challenger earlier that year.