The next hours would be critical. Engineers and scientists would be monitoring the cap around the clock, looking for pressure changes. High pressure is good, because it shows there's only a single leak. Low pressure, below 6,000 pounds per square inch or so, could mean more leaks farther down in the well.
President Barack Obama, who has encouraged, cajoled and outright ordered BP to stop the leak, called Thursday's development "a positive sign." But Obama, whose political standing has taken a hit because of the spill and accusations of government inaction, cautioned that "we're still in the testing phase."
The worst-case scenario would be if the oil forced down into the bedrock ruptured the seafloor irreparably. Leaks deep in the well bore might also be found, which would mean that oil would continue to flow into the Gulf. And there's always the possibility of another explosion, either from too much pressure or from a previously unknown unstable piece of piping.
The drama that unfolded quietly in the darkness of deep water Thursday was a combination of trial, error, technology and luck. It came after weeks of repeated attempts to stop the oil -- everything from robotics to different capping techniques to stuffing the hole with mud and golf balls.
The week leading up to the moment where the oil stopped was a series of fitful starts and setbacks.
Robotic submarines working deep in the ocean removed a busted piece of pipe last weekend, at which point oil flowed unimpeded into the water. That was followed by installation of a connector that sits atop the spewing well bore -- and by Monday the 75-ton metal cap, a stack of lines and valves latched onto the busted well.
After that, engineers spent hours creating a map of the rock under the sea floor to spot potential dangers, like gas pockets. They also shut down two ships collecting oil above the sea to get an accurate reading on the pressure in the cap.
As the oil flowed up to the cap, increasing the pressure, two valves were shut off like light switches, and the third dialed down on a dimmer switch until it too was choked off.
And just like that, the oil stopped.
It's not clear yet whether the oil will remain bottled in the cap, or whether BP will choose to use the new device to funnel the crude into four ships on the surface.
For nearly two months, the world's window into the disaster has been through a battery of BP cameras, known as the "spillcam." The constant stream of spewing oil became a fixture on cable TV news and web feeds.
That made it all the more dramatic on Thursday when, suddenly, it was no more.
On the video feed, the violently churning cloud of oil and gas coming out of a narrow tube thinned, and tapered off. Suddenly, there were a few puffs of oil, surrounded by cloudy dispersant that BP was pumping on top. Then there was nothing.
"Finally!" said Renee Brown, a school guidance counselor visiting Pensacola Beach, Fla., from London, Ky. "Honestly, I'm surprised that they haven't been able to do something sooner, though."
Alabama Gov. Bob Riley's face lit up when he heard the news. "I think a lot of prayers were answered today," he said.
Thad Allen, the retired Coast Guard admiral overseeing the spill for the government, said they are deciding as they go along whether to release oil into the water again. At the end of the 48-hour test it's possible oil will start to flow again -- but, theoretically, in a controlled manner.
When the test is complete, more seafloor mapping will be done to detect any damage or deep-water leaks.
The saga has devastated BP, costing it billions in everything from cleanup to repair efforts to plunging stock prices. Though BP shares have edged upward, they shot higher in the last hour of trading on Wall Street after the company announced the oil had stopped. Shares rose $2.74, or 7.6 percent, to close at $38.92 -- still well below the $60.48 they fetched before the rig explosion.