Tim Peake's historic first walk in space ended early after a water bubble was detected in the helmet of his colleague Tim Kopra.
The British astronaut helped complete the crew's primary task of repairing a broken voltage regulator and headed back to the International Space Station (ISS) after four hours and 43 minutes instead of the planned six-and-a-half hours.
Live footage showed them safely returning to the ISS's airlock area and the thermal cover being closed behind them.
Major Peake, 43, from Chichester, West Sussex, became the first Briton to ever complete an Extra-Vehicular Activity (EVA) - or spacewalk - during the maintenance operation with his American colleague.
Major Peake, who is on a six-month mission with the European Space Agency (ESA), earlier told of his pride in stepping into space with the Union flag on his space suit.
After the operation was terminated by the lead Flight Director, Major Peake and Colonel Kopra were told to spend some time cleaning up their tools before heading to safety.
NASA said the termination was a precaution.
A tweet from its official account said: "As a precaution, spacewalk terminated due to small amount of water in Tim's helmet."
The ESA said the early termination of the spacewalk was officially completed at 17.31 GMT.
Colonel Kopra offered his thanks to the ground staff for ensuring their safety.
Major Peake added: "Thank you very much, I just want to reiterate Tim's words there, you guys have done a great job, thanks for everybody's support."
Colonel Kopra's helmet-absorption pad, along with a sample of the water bubble taken with a syringe, will be analysed to determine what caused it to form.
Crew member Scott Kelly photographed Major Peake's gloves for "future reference and inspection", the ESA said, before his helmet was removed too.
Earlier, Major Peake's parents, Nigel and Angela Peake, beamed with pride as they watched their son's progress from their living room in Westbourne, Emsworth, Hampshire.
Mr Peake said: "It's amazing, the photographs from space are incredible.
"For us, we have immense pride, but also immense gratitude to all the people who are supporting Tim and the other astronauts."
New flight rules were brought into effect after a similar incident took place in 2013, when Luca Parmitano had a large amount of water fill his helmet.
CO2 sensors have been fitted in the helmets of astronauts since then, and these helped alert Colonel Kopra to the problem.