Donald H. Peterson Sr., an astronaut who served on the maiden voyage of the space shuttle Challenger and performed a spacewalk to test the ability of repairing the vehicle while it orbited more than 170 miles above the Earth, died May 27 at his home in El Lago, Tex. He was 84.

The cause was Alzheimer’s disease and bone cancer, said a daughter, Shari Peterson.

An Air Force veteran, Mr. Peterson joined NASA’s astronaut corps in September 1969, two months after Neil Armstrong led the historic first landing on the moon. Fourteen years later, Mr. Peterson joined the crew of the sixth NASA space shuttle mission — and the Challenger’s first flight. (The shuttle exploded in 1986 while on its 10th mission.)

Soviet and American astronauts had conducted spacewalks since 1965, but the ability to exit the shuttle was an important step toward being able to perform repair and maintenance work on a space vehicle.

Mr. Peterson and fellow mission specialist Story Musgrave dressed in 250-pound white spacesuits with attached backpacks that allowed for greater mobility.

Before exiting the Challenger, Mr. Peterson had to breathe pure oxygen for three-and-a-half hours, to gradually reduce excess nitrogen from his body. This was done to avoid decompression sickness, a condition similar to what scuba divers experience when changing air pressures too rapidly.

The fresh oxygen made a “nice whishing sound,” so Mr. Peterson turned his receiver down and fell into “probably the best sleep I had on orbit,” he recalled in a NASA oral-history interview in 2002. “People asked, ‘How in the world can you sleep just before you’re getting ready to go?’ I said, ‘Well, you know, you get tired enough, you can sleep almost anywhere.’ ”

Notable deaths in 2018 and 2019: Nipsey Hussle, George H.W. Bush, Stan Lee, John McCain, Aretha Franklin and other famous faces we’ve lost

Nipsey Hussle, a Grammy nominated rapper who sought to revive South Los Angeles, died at age 33 on March 31. Read the obituary (Matt Winkelmeyer/Getty Images for Warner Music)

By 4:30 p.m., Mr. Peterson and Musgrave were in the 60-foot cargo bay, checking maintenance materials that future crews would need to preserve and, if necessary, repair the spacecraft. For about four hours, they appeared to move “like underwater swimmers” as the shuttle orbited the Earth at 17,500 mph, The Washington Post reported at the time.

The men were roped to the shuttle’s cargo bay while they tested their ability to carry a weighted bag, use a hand winch and perform other tasks.

After launching a satellite, the crew decided they should test what would happen if the electronic motors powering the ability to tilt the collar at the back of the Orbiter stopped working.

“We had foot restraints, but it took so long to set them up and move them around, that we didn’t want to do that,” Mr. Peterson said in the NASA interview. “So I just held on with one hand, actually, to a piece of sheet metal, which is not the best way to hold on, and cranked the wrench with my other hand, and my legs floated out behind me. So as I cranked, my legs were flailing back and forth, like a swimmer, to react the load on the wrench.”

During this test, his suit started to leak. “I’ve got an alarm,” he told Musgrave.

“Story stopped what he was doing and came over,” Mr. Peterson recalled. “We were trying to check what was going on, and the seal popped back in place and the leak stopped.” They then finished the procedure.

Donald Herod Peterson was born in Winona, Miss., on Oct. 22, 1933. His father ran a service station and sold furniture . Mr. Peterson’s avid consumption of science fiction in his childhood drove his interest in aviation and space.

He graduated in 1955 from the U.S. Military Academy at West Point, N.Y., and in 1962 he received a master’s degree in nuclear engineering from the Air Force Institute of Technology at Wright-Patterson Air Force Base in Ohio.

Early in his military career, he worked for the Air Training Command as a flight instructor and for the Air Force Systems Command as a nuclear systems analyst.

He served 24 years in the Air Force before retiring at the rank of colonel. After leaving NASA in 1984, he became a consultant on manned aerospace operations. His awards included the Meritorious Service Medal and the Air Force Commendation Medal.

His wife of nearly 60 years, the former Bonnie Ruth Love, died in 2017. In addition to his daughter, of League City, Tex., survivors include two other children, Don Peterson Jr. of Fort Worth and Jean Stone of San Antonio; a brother; four grandchildren; and four great-grandchildren.