Two American astronauts have taken a spacewalk to replace ageing batteries on the International Space Station.

Nasa’s Anne McClain and Nick Hague took six hours and 39 minutes to swap three old nickel-hydrogen batteries with more powerful lithium-ion batteries.

They struggled with a stubborn bolt on the last battery plate but eventually got the piece of battery equipment out and installed.

Despite the difficulty, the astronauts finished the job faster than Nasa planned, so Ms McClain got a chance to do a bit of unusual station cleaning.

She took a scraper wrapped with sticky tape and picked up bits of tiny space debris attached to one section of the station.

The rookie spacewalkers had to be reminded to enjoy the view from about 250 miles up. Near the end of the spacewalk, astronaut Thomas Pesquet at Mission Control told Ms McClain: “There’s the Earth right behind you.”

“I noticed. Beautiful,” she said.

As the spacewalkers were taking off their spacesuits, they got a surprise message from Mr Hague’s wife, Air Force Lt Col Catie Hague: “You guys nailed it. Awesome job. Talk to you later. Love you.”

The station’s robotic arm had done much of the heavy work beforehand but the astronauts still had to lug 300-pound pieces the size of a large coffee table and reconnect battery wiring.

There are more replacements of the 20-year-old station’s original batteries to come. Nasa is about halfway through replacing 48 batteries with ones that are expected to last the remainder of the station’s life.

The space station uses solar panels to generate power but the batteries are used when it is in the dark and not getting power from the sun.

Friday’s spacewalk was the first of three planned excursions to replace batteries and perform other maintenance. Next week’s spacewalk will include the first all-female crew, including Ms McClain.

This was the 214th spacewalk to assemble and maintain the space station.