With the shuttle's commander, Scott Altman, steering Atlantis, astronaut Megan McArthur reached out and grabbed the Hubble with the ship's robot arm. Then she gently lowered the telescope into the shuttle's cargo bay.
"Houston, Atlantis," Altman called to Mission Control. "Hubble has arrived on Atlantis with the arm."
It was a delicate operation, with the two giant spacecraft flying in formation at 17,200 miles per hour, more than 300 miles above the Earth's surface.
"I'm going to have to remind myself to breathe, and take it real slow," McArthur had said in an interview with ABC News before the flight.
Astronaut John Grunsfeld -- an astronomer by training -- took the microphone in the crew cabin a few minutes after the capture.
"I'm looking out the window here, and it's an unbelievably beautiful sight," he said.
Grunsfeld is on his fifth space flight, and his third to service the Hubble. He has said he felt strongly about the telescope -- even during the two year period when NASA thought this mission was too risky to fly, and Grunsfeld, then the agency's chief scientist, had to go along with the decision.
Atlantis' astronauts, who have been training for this mission since 2006, plan a series of five space walks on successive days. The telescope is now locked in a specially-designed cradle at the rear of the shuttle's cargo bay, so that the astronauts can safely work on it.
They have to replace the telescope's batteries, gyroscopes, fine guidance system and other parts. They also carry new insulation to surround the Hubble's body so that it can better withstand the extreme temperatures of space.
The mission, designated STS 125 by NASA, is the last chance to save the Hubble telescope, whose batteries, cameras and gyroscopes are badly in need of replacement.
As the shuttle gradually closed in on the Hubble Tuesday, it underwent a tedious but necessary inspection to make sure it had not been damaged during liftoff. The shuttle Columbia was lost in 2003 because damage to one wing went unnoticed.
When orbiters travel to the International Space Station, they do a flip so that the space station crew can inspect the belly for damage. Since Hubble, obviously, doesn't have a crew to help them out, Atlantis' crew had to do all the work.
"We are going to inspect the vehicle to the same standards as a [space] station mission," Altman told ABC News before the launch. "We are doing that by using the boom out there with the sensors on it."
A boom attached to the end of the shuttle's robot arm was moved slowly over Atlantis' wings and underside Tuesday, with a camera and laser to look for potential damage.
Such work makes the flight a bit longer, Altman said.
This is the fifth and final space shuttle mission to the Hubble. It has been seven years since a shuttle last visited the telescope, and it is in need of a service call.