NEW YORK — Two space station astronauts hit pay dirt in orbit Aug. 16 after successfully replacing a vital pump to restore their spacecraft’s cooling system, which had been limping along at half-power for more than two weeks.

Astronauts Douglas Wheelock and Tracy Caldwell Dyson wired a bulky ammonia pump the size of a kitchen oven into the right side of the space station during the hours-long spacewalk. It was the third spacewalk for the astronauts to make the tricky repair 354 kilometers above Earth.

A fourth spacewalk eventually will be needed to clean up some final work, but is not pressing, mission managers said.

“It was a lot of hard work today, and hopefully we’ll have a pump up and running and be back in business on the space station,” Wheelock said as the spacewalk ended.

Mission Control used remote commands to start filling the pump with liquid ammonia. By Aug. 19, the coolant system was back on line, allowing the crew to restart science equipment and other systems that had to be shut down for more than two weeks.

The space station’s cooling system had been running at half-strength since July 31, when an electrical short shut down one of two pumps that move liquid ammonia through the system. The failure forced astronauts to turn off some experiments and systems, as well as leave others without backups, in order to prevent the station from overheating. Scientific research was stalled as well.

NASA station managers have said the ammonia pump failure has been one of the most challenging repairs for the international space station. The cooling system is so critical to station operations that a pump repair is one of 14 major failures for which NASA engineers have prepared emergency plans, they added.

While the space station crew tackled the problem in space, a team of engineers and astronauts on Earth worked round-the-clock to come up with the repair plans.

It took two spacewalks just to remove the broken pump from its housing. That disabled pump is parked in a temporary spot and must be moved to its final perch on a spare parts platform in yet another spacewalk.

There are four spare ammonia pumps on the space station, one of which was used for this repair. Each pump weighs 353 kilograms and is 1.6 meters long by 1.2 meters wide. The replacement pump used Aug. 16 was delivered in 2006.

The spacewalk began at 6:20 a.m. EDT, about 35 minutes ahead of schedule. The astronauts swiftly tackled their first chore: removing the new pump from a spare-parts platform on the station’s exterior.

“You know, when you’re on the [spare-parts platform] looking down at the Earth like this, it’s like extreme hang gliding,” Caldwell Dyson said.

One of four bolts securing the pump in place gave Wheelock some trouble when it did not budge, but some extra elbow grease and tools did the trick. After that, the astronauts hooked up five power cables and four liquid ammonia hoses.

They saw no major leaks of the toxic coolant like those seen on the earlier spacewalks.

There are two main cooling system loops — Loop A and Loop B. The failed pump is in Loop A, while the other cooling loop remains operational. The broken pump was delivered to the space station in 2002 and was activated in 2006.

The $100 billion international space station is currently home to six astronauts; three Americans and three Russians. Spare parts are a key concern since the station is slated to keep flying through at least 2020. NASA plans to fly two more shuttle missions (in November of this year and February 2011) before retiring its three remaining space shuttles. A potential extra shuttle flight, which would launch next summer if approved, is under discussion in Congress.

Once the space shuttle fleet is retired, NASA will rely on spacecraft from Russia to launch crews and cargo to the space station until American-built commercial spaceships or new government vehicles become available. Unmanned cargo ships built by the Japanese and European space agencies are also expected to keep the station stocked with supplies.

The spacewalk Aug. 16 was the sixth career spacewalk for Wheelock and the third for Caldwell Dyson.

It was also the 150th spacewalk dedicated to space station assembly and maintenance.

The space station has been under construction since 1998 by 15 countries and five different space agencies.