The Dow Jones industrial average climbed 277 points, its second-biggest gain this year, and stocks advanced even further in Europe, in strong and weak countries alike.
The price of oil posted its biggest one-day increase in more than three years, and other commodities shot higher _ signs of hope that a deal in Europe will remove a big barrier to a healthier world economy.
In Brussels, leaders of the 17 countries that use the euro appeared finally to have found a broad strategy to fight a debt crisis that has hounded European governments and world investors for three years.
The leaders agreed to pump money directly into stricken banks, let some countries tap into rescue money without submitting to stringent budget requirements and, later, tie European governments closer in economic union.
David Kelly, chief global strategist at JPMorgan Funds, said it was becoming clear that European leaders will compromise to solve the crisis. One of the biggest stock gains Friday came in Germany, which took a hard line in earlier negotiations.
The whole language is positive here,'' he said. ``Every time they've stared over the cliff into the abyss of a euro breakup, they've realized it's much wiser to get closer together.''
There was a sign immediately that Europe's latest plan was working: The cost for the troubled government of Spain to borrow money on the bond market fell dramatically, by more than half a percentage point, to 6.34 percent.
Previous market rallies tied to progress in Europe have proved temporary. But for the day, at least, global stock markets were jubilant:
In New York, the Dow Jones industrial average closed up 277.83 points, only a sliver below its high for the day. The Standard & Poor's 500 index soared 2.5 percent. The rally left the S&P with a gain of 8.3 percent at the halfway mark for the year.
The benchmark stock index in Germany rose 4.3 percent, by far its best performance this year. Germany has the strongest economy in Europe, and it depends heavily on exports, so it needs other countries to stay healthy.
Stocks hit their highest level in two months in Italy and Spain, two of the countries with the shakiest finances. Stocks also neared a two-month high in Greece, another epicenter of the debt crisis.
Traders sold U.S. Treasurys, sending the yield on the 10-year Treasury note up to 1.65 percent from 1.57 percent late Thursday, as demand decreased for ultra-safe investments.
Energy prices rose sharply because a cure for Europe's debt problem would remove a big drag on global economic growth. The price of oil jumped $7.27 per barrel to $84.96. It was a gain of 9.4 percent, the biggest for oil since March 2009.
Gold gained $54, the biggest jump since June 1, to $1,604 an ounce. Copper and silver both rose about 5 percent. Copper is a key ingredient of economic expansion because of its use in electrical wiring, pipes and machinery.
The euro gained 2.3 cents against the dollar, to $1.2651.
On Thursday, economic reports from the United States were discouraging, and the Dow fell as much as 177 points. But stocks staged a big comeback late in the day, partly because rumors swirled that European leaders were more conciliatory.
News of the deal in Europe broke overnight, and on Friday, stocks soared from the open. The Dow swung 430 points between its Thursday low and the high it reached late Friday.
Some market analysts remained cautious. Uri Landesman, president of Platinum Partners LLC, a New York hedge fund, said he expects more sharp leaps and dives this summer as traders speculate about Europe's future.
This Europe thing is going to trade up and down based on the news of the day,'' Landesman said.
Kelly took a brighter view. Besides the Europe deal, he referred to a Greek election this month carried by pro-bailout parties and the Supreme Court's decision Thursday to uphold most of President Barack Obama's health care overhaul.
Uncertainty is diminishing,'' he said. ``These are all big question marks that have been out there, and as those question marks decrease, stock prices and interest rates increase.''
As the first half of the year ends, there are still reasons to worry about the world economy: China's expansion is slowing, and U.S. employers have created fewer jobs in the past three months. A report next Friday is expected to show a fourth straight month of anemic U.S. job growth.
Because of the economic fears and a deep slump in May as Spain's banks teetered near collapse, the S&P 500 lost 3.3 percent for the quarter.
There may be more damage in store, Landesman said. ``I remain quite negative about the market in the next two months,'' he said, adding that lower trading volumes during the summer can lead to choppier trading.
The S&P 500 at least started the summer strong. It rose 4 percent in June, its best month since February and its strongest June since 1999.
For the year, the Dow is up 662.53 points for the year, or 5.4 percent. The Nasdaq composite index is up 12.7 percent.
For the day, the Dow closed up 277.83 points, or 2.2 percent, at 12,880.09. The S&P 500 rose 33.12, or 2.5 percent, to 1,362.16. The Nasdaq rose 85.56, or 3 percent, to 2,935.05.
Industrial and information technology stocks rose the most of the 10 industry groups in the S&P 500. Those companies would benefit from faster growth and stronger demand from Europe, a key trading partner.
In corporate news, Research in Motion, maker of the BlackBerry, plunged 20.3 percent after the company posted quarterly results that suggest it is crumbling faster than thought. RIM is cutting 5,000 jobs and unexpectedly delaying the launch of new phones deemed critical to its survival.
The biggest gainer in the S&P was the alcoholic beverage giant Constellation Brands. The stock jumped 24.4 percent after the company secured the right to distribute Corona beer and other popular brands in the U.S. Constellation bought the other half of Crown Imports LLC from Grupo Modelo for $1.85 billion.
Nike plunged 9.4 percent, the biggest drop in the S&P 500. The world's largest athletic shoe and clothing company said profit dropped 8 percent last quarter on high product costs, a restructuring charge and an unexpected customs assessment.