Space shuttle Atlantis astronauts on Sunday repaired a failed instrument on the Hubble Space Telescope used to discover black holes and other galactic phenomena following a tedious spacewalk mired by equipment glitches.

Like Hubble's advanced camera, which was rewired during a spacewalk on Saturday, the Space Telescope Imaging Spectrograph was not designed to be overhauled in space.

The device, known by the acronym STIS, splits light into its component wavelengths. It was shut down in 2004 after electronics problems cut off its power.

It was the fourth of five back-to-back spacewalks planned for shuttle Atlantis' 11-day servicing mission, NASA's fifth and final visit to the observatory before the shuttles are retired next year.

NASA hopes the improvements will keep Hubble operational until at least 2014 so it can work in tandem with its replacement, the James Webb Space Telescope.

Spacewalkers Michael Massimino and Michael Good had expected problems unscrewing 111 fasteners on the STIS cover plate, which had to be removed to access its faulty circuit board. But what frustrated the astronauts was a stripped bolt on a handrail that needed to be removed before they could reach STIS.

Massimino ended up tearing off the handle with brute force.

The spacewalkers then installed a custom-made device to catch the 111 screws, but when Massimino went to use his battery-operated screw-driver, nothing happened.

Oh, for Pete's sake, Massimino said.

He returned to the shuttle's airlock to pick up a spare tool and recharge his spacesuit with oxygen.

How are you guys doing inside of the spaceship? Massimino asked his crewmates.

It's a real nail-biter buddy, replied astronaut Andrew Feustel.

PREVIOUS CALLS

On previous servicing calls to Hubble, astronauts installed two new science instruments, replaced Hubble's steering system and half its batteries, and repaired the advanced camera.

Engineers tested the camera overnight and found that one of its three channels was not restored.

It appeared down for the count, said NASA mission commentator Josh Byerly. But Hubble project scientist Preston Burch said that this partial recovery of the camera was not unexpected.

NASA only had time and resources to rewire one part of the camera and scientists' chose the more popular wide-field mode.

We would have liked to have a done a similar thing with the high resolution channel, Burch said.

But the scientists were not complaining.

With the refurbishments already accomplished, NASA is close to fulfilling its goals for the mission, with only the installation of another three batteries remaining. That job is scheduled for the mission's last spacewalk on Monday.

They've made huge strides in restoring the health of the observatory, Burch said.

Recovering STIS would be a bonus.

STIS is not a Spartan instrument. It had many bells and whistles, all of which have been proven to be valuable to many types of science, said Hubble project scientist David Leckrone.

The instrument was used, for example, to survey galaxies for black holes. It also made the first measurements of the atmosphere of a planet in another solar system.

(Editing by Philip Barbara)