Neil Armstrong on 16 July 1969. Four days later – as Apollo 11 commander – he became the first man to set foot on the moon. Photograph: Sportsphoto Ltd/Allstar

The US astronaut Neil Armstrong secured his place in history on 20 July 1969, when, as commander of the Apollo 11 spacecraft, he was the first man to set foot on the moon, and made his famous statement: "That's one small step for man, one giant leap for mankind." Armstrong, who has died aged 82, was accompanied on that epic journey by Edwin "Buzz" Aldrin, the pilot of the lunar landing module with the call sign Eagle, and Michael Collins, pilot of the command module with the call sign Columbia.

The crew of Apollo 11 were not chosen for the mission because they were in any way special among the elite group of test pilots who comprised the corps of American astronauts: it was simply their turn on the flight roster. If an earlier plan had succeeded, the crew of Apollo 10 would have made the first moon walk in May 1969, but because of delays in the development of the lunar module that mission became a full dress rehearsal for a lunar landing, all bar a touchdown.

Armstrong cut his teeth as an astronaut in March 1966 as commander of the Gemini 8. The mission also involved the first serious space emergency, highlighting the dangers of manned space launches when the public were beginning to take their seemingly effortless success for granted. The Gemini 8 mission was designed to perform the first docking in space by astronauts. The Soviet Union had already demonstrated automated docking of two unmanned vehicles in orbit. Armstrong and his crewmate, David Scott, were to rendezvous with a 7,000lb Agena rocket target vehicle.

They found the Agena and docked successfully, but when they tried a pre-arranged manoeuvre of the combined spacecraft it went into a spin. Armstrong disengaged from the Agena, thinking the problem was there, but the tumbling worsened. The Agena steadied but the Gemini capsule kept turning at 360 degrees a second and was in danger of colliding with the Agena.

The fault was clearly on Gemini. It was discovered later that one of 16 Gemini thruster rockets was stuck. As he was unable to stop the spacecraft turning with the main thrusters, Armstrong shut them down and brought the Gemini craft under control using a second set of 16 thrusters that were intended only to control the capsule's re-entry in to the Earth's atmosphere.

Mission Control ordered Armstrong and Scott to cut the flight short and they splashed down in a contingency recovery area in the Pacific Ocean. The drama of surviving man's first space emergency completely obscured the fact that it was on the Gemini 8 mission that the US had overtaken the Soviet Union in space technology

Armstrong was born in Wapakoneta, Ohio, and from a young age was fascinated with aviation, experimenting with model airplanes and a home-built wind tunnel. At 15 he began flying lessons in an Aeronca Champion, and by 16 acquired his student pilot's licence. In 1947, he enrolled at Purdue University on a Navy scholarship to pursue a degree in aeronautical engineering, but in 1949 the Navy called him to active duty in the Korean War. As a navy pilot, he flew 78 combat missions. He was shot down once and received three medals for his military service. In 1952 he returned to his studies and completed his BSc at Purdue and an MSc in aerospace engineering at the University of Southern California.

In 1955 he became a civilian research pilot at the Lewis research centre of the National Advisory Committee for Aeronautics (Naca), the forerunner of the National Aeronautics and Space Administration (Nasa). Later that year, he transferred to Naca's high-speed flight station (today, Nasa's Dryden flight research centre) at Edwards Air Force Base in California as an aeronautical research scientist, and then as a pilot. He was a test pilot on many pioneering high-speed aircraft, including the 4,000mph X-15. He flew over 200 different models of aircraft, including jets, rockets, helicopters and gliders.

Armstrong was engaged in both piloting and engineering aspects of the X-15 programme from its inception. He completed the first flight in the aircraft equipped with a new self-adaptive flight control system and made seven flights in the rocket plane. In 1962 he was of the nine test pilots chosen by Nasa for its second astronaut-training programme.

Four years later Armstrong made his successful recovery of the Gemini 8 spacecraft in a situation that, if misjudged, could easily have resulted in the death of the crew. That achievement was also invaluable in helping Nasa meet the target set in May 1961 by President John F Kennedy for the USA to establish, as a national goal, a manned landing on the moon by the end of the decade.

The choice among competing techniques for achieving a moon landing still needed some intensive research and development. The method ultimately employed, of a lunar-orbit rendezvous, was influenced strongly by the experience with Gemini 8, and there was an element of poetic justice in Armstrong being at the helm again for the first manned lunar landing attempt.

On 16 July 1969, Apollo 11 blasted off for the moon. Four days later, at 4.18pm EDT (Eastern Daylight Time), the Eagle lunar lander was guided to land on a plain near the southwesten edge of the Sea of Tranquility. At 10.56pm Armstrong stepped off the ladder of the Apollo 11 lunar module and became the first human being to set foot on the moon. Twenty minutes later Buzz Aldrin joined him for two hours of ceremonies and moon-rock collecting. They unveiled a plaque and read the text to a worldwide TV audience, "Here men from the planet earth first set foot on the moon July 1969 AD. We came in peace for all mankind."

After raising the American flag and talking to President Nixon by radiotelephone, the two astronauts took numerous photographs, carried out the lunar surface experiments assigned to the mission and collected 22kg of samples of lunar soil and rocks. All the astronauts' lunar activities were televised in black-and-white. Meanwhile, Collins continued orbiting the moon alone in the Columbia command module. Armstrong and Aldrin re-entered the lunar module and closed the hatch at 1.11am on 21 July. The Eagle took off from the moon at 1.54pm, having spent 21 hours 36 minutes on the lunar surface. It docked with Columbia at 5.35pm.

After splashdown in the Pacific on 24 July, decontamination procedures began. The astronauts were carried by helicopter to the recovery ship, USS Hornet, where they entered a mobile quarantine facility to begin a period of observation under strict quarantine conditions. The command module was recovered and also removed to the quarantine facility, and the rock samples and film were flown to Houston.

Following the moon landing and the subsequent world tours by the crew of Apollo 11, Armstrong became deputy associate administrator for aeronautics, Nasa headquarters office of advanced research and technology from 1969 to 1971, when he resigned. For the next eight years he was professor of aerospace engineering at the University of Cincinnati. Numerous industrial appointments followed, including New York's AIL Systems, where he was chairman from 1981 until 2001. In 1979 he was chairman of the board of Ohio's Cardwell International; from 1982 to 1992 chairman of Computing Technologies for Aviation, in Virginia.

In 1985-86 he served on the National Commission on Space, a presidential committee to develop goals for a national space programme into the 21st century; and was also vice-chairman of the committee investigating the Space Shuttle Challenger disaster in 1986. During the early 1990s he presented an aviation documentary series for television entitled First Flights. Earlier this year he spoke at an event to mark the 50th anniversary of the orbiting of the Earth by the first American to do so, John Glenn.

Armstrong is survived by his second wife, Carol, and two sons from his first marriage, which ended in divorce.

• Neil Alden Armstrong, astronaut, born 5 August 1930; died 25 August 2012