After a month of frantic tinkering, NASA said Friday that its aging Hubble Space Telescope was on the mend, recovering from a computer problem that crippled what many astronomers call the most productive scientific instrument ever built.

As the bus-size observatory circled Earth, space agency engineers worked by remote control to switch Hubble from its vintage electronics to backup hardware. In the final step, they powered up a payload computer that restored control of its six cameras and sensors, which peer through visible, infrared and ultraviolet wavelengths of light to the edge of space and the dawn of time.

“We are absolutely delighted that the observatory is up and running again,” said Kenneth Sembach, director of the Baltimore-based Space Telescope Science Institute, which handles the Hubble science operations. “All indications are that it’s doing well and we will get back to doing science again this weekend.”

In more than a million mind-expanding images of the universe snapped over the past 31 years, the solar-powered telescope has presented to astronomers and amateur stargazers alike a psychedelic tapestry of infant stars, dying supernovae, colliding galaxies, towering billows of stellar dust, dark matter and black holes feasting on spiral nebulae.

Hubble data has been used in more than 18,000 scientific papers that have documented the accelerating expansion of the universe, the evolution of galaxies and studies of planets beyond our solar system, NASA officials said.

“I think there’s a very credible case that the Hubble Space Telescope is the most scientifically productive instrument ever made,” said Paul Hertz, director of NASA’s astrophysics division. “The output of peer-reviewed published papers from Hubble certainly exceeds any of its competitors in any field of science.”

But then on June 13, Hubble was hobbled—and not for the first time. Technical problems that threatened to end the mission have plagued the telescope since the moment it reached its orbital perch some 340 miles above our planet’s surface on April 25, 1990.

Since its launch in 1990, five space shuttle missions have repaired, upgraded and replaced systems on the telescope.

Since its launch in 1990, five space shuttle missions have repaired, upgraded and replaced systems on the telescope.

Photo: /Associated Press

Since its launch—with flawed optics causing its photos to be so blurry that the $4.7 billion observatory was initially deemed an embarrassing failure—five space shuttle missions repaired, upgraded and replaced systems on the telescope. All five of its main instruments were fixed, and a $50 million set of corrective lenses was installed to address its manufacturing flaws.

Last repaired by space shuttle astronauts in 2009, Hubble has lasted twice as long as originally expected, space agency officials said.

The latest trouble began when a voltage overload in an onboard payload computer built in the 1980s tripped a circuit breaker and shut down the telescope. It was the most serious technical failure that NASA project engineers had encountered in the 11 years since the last shuttle repair.

“We did a lot of debugging,” said James Jeletic, deputy project manager for the Hubble Space Telescope Project at NASA’s Goddard Space Flight Center in Greenbelt, Md. After three weeks of painstaking analysis, they decided to switch the telescope to its remaining backup systems.

“Every single thing worked as planned,” Mr. Jeletic said. “The computer came back up. All the backup hardware works fine. I don’t think we’re biting our fingernails anymore.”

Write to Robert Lee Hotz at sciencejournal@wsj.com