Every drop of water on board the ISS is precious
Astronauts have fixed a urine-recycling unit on the International Space Station, needed to support a six-person crew at the research outpost next year.
The mission of the US space shuttle Endeavour was extended by one day to fix the machine, which is designed to convert urine into drinking water.
The equipment had failed several times since it was delivered a week ago.
The shuttle is now due to return to the Kennedy Space Center in Florida on Sunday after 16 days in orbit.
"Not to spoil anything, but I think up here the appropriate words are 'Yippee!'," space station Commander Mike Fincke told mission control early on Tuesday morning.
He supervised work on the malfunctioning water regeneration system - which distils, filters, ionises and oxidises wastewater including urine, perspiration and bath water, into drinkable water.
He reported that two rounds of modifications to stabilise the device's centrifuge appeared to have worked.
"There will be dancing later," mission controllers replied.
The urine device has already completed a full five-hour run on Monday and was nearing completion of a second full run on Tuesday morning, the Associated Press reported.
Engineers planned to keep the device operating throughout the day in the hope of producing enough processed urine before Endeavour's departure on Friday.
Nasa needs the new system operating before it can expand the station's crew from three to six people, which is currently scheduled for May 2009.
The urine-recycling device was ferried into orbit and installed in the space station's Destiny laboratory after the shuttle arrived on 16 November.
The Endeavour mission is part of a $250m (£165m) "home improvement" effort at the space station.
As well as the recycling unit, the space station has been fitted with a new freezer, a scientific oven, two sleeping quarters, exercise equipment, an additional toilet and new food preparation facilities.
The fix came a day after astronauts finished a fourth and final spacewalk to repair a mechanism to keep the station's solar panels pointed towards the sun.
While the crews slept, engineers on the ground watched as the newly-repaired joint automatically pivoted to track the sun for the first time in a year.
Work has been somewhat slower than expected because astronaut Heide Stefanyshyn-Piper lost her tool bag during the first spacewalk.
Nasa plans eight more flights to the station, a $100bn (£66bn) project of 16 nations, before the shuttles are retired in 2010.