NEW YORK - The Dow Jones industrial average surged nearly 340 points Thursday after European leaders agreed on a deal to slash Greece's debt load and prevent the crisis there from engulfing larger countries like Italy. The Standard & Poor's 500 index is close to having its best month since 1974.
Commodities and Treasury yields soared as investors took on more risk. The euro rose sharply against the dollar.
Europe's sweeping agreement, reached after an all-night summit meeting, is aimed at preventing the Greek government's inability to pay its debt from escalating into another financial crisis like the one that happened in September 2008 after the collapse of Lehman Brothers.
Banks agreed to take 50 percent losses on the Greek bonds they hold. Europe will also strengthen a financial rescue fund to protect the region's banks and other struggling European countries such as Italy and Portugal.
"This seems to set aside the worries that there would be a massive contagion over there that would have brought everything down with it," said Mark Lamkin, head of Lamkin Wealth Management.
Stronger U.S. economic growth and corporate earnings also drove markets higher. The government reported Thursday that the economy grew at a 2.5 percent annual rate from July through September on stronger consumer spending and business investment. That was nearly double the 1.3 percent growth in the previous quarter.
The Dow Jones industrial average soared 339.51 points, or 2.9 percent, to 12,208.55. All 30 stocks in the Dow rose, led by Bank of America Corp. with a 9.6 percent gain. It was the first time the Dow closed above 12,000 since Aug. 1
The Dow is up 11.9 percent for the month so far. With only two full days of trading left in October, the Dow could have its biggest monthly gain since January 1987. The Dow's jump was its largest since Aug. 11th, when it rose 423.
The S&P 500 rose 42.59, or 3.7 percent, to 1,284.59. The gain turned the S&P positive for the year for the first time since Aug. 3, just before the U.S. government's debt was downgraded. The index is up 13.5 percent for the month, its best performance since a 16.3 percent gain in October 1974.
The Dow and S&P have both fallen for the previous five months.
The Nasdaq composite jumped 87.96, or 3.3 percent, to 2,738.63.
Small company stocks rose more than the broader market. That's a sign investors were more comfortable holding assets perceived as being risky but also more likely to appreciate in a strong economy. The Russell 2000 index jumped 5.3 percent.
Raw materials producers, banks and stocks in other industries that depend on a strong economy for profit growth led the way. Copper jumped 5.8 percent to $3.69 a pound and crude oil jumped 4.2 percent to $93.96 a barrel.
The euro rose sharply, to $1.42, as confidence in Europe's financial system grew. The euro was worth $1.39 late Wednesday and had been as low as $1.32 on Oct. 3. European stock indexes also soared. France's CAC-40 rose 6.3 percent and Germany's DAX jumped 6.1 percent.
Investors sold U.S. Treasury notes and bonds, an indication they were moving away from safer investments. The yield on the 10-year Treasury note, which moves in the opposite direction of its price, rose to 2.38 percent from 2.21 percent late Wednesday.
European leaders still have to finalize the details of their latest plan. French President Nicolas Sarkozy spoke with Chinese President Hu Jintao amid hopes that countries with lots of cash like China can contribute to the European rescue.
Past attempts to contain Europe's two-year debt crisis have proved insufficient. Greece has been surviving on rescue loans since May 2010. In July, creditors agreed to take some losses on their Greek bonds, but that wasn't enough to fix the problem.
Some analysts cautioned that Europe's problems remained unsolved. "The market keeps on thinking that it's put Europe's problems to bed, but it's like putting a three-year old to bed: you might put it there but it won't stay there," said David Kelley, chief market strategist at J.P. Morgan Funds. Kelly said that Europe's debt problems will remain an issue until the economies of struggling nations like Greece and Portugal grow again.
CBS MoneyWatch's Jill Schlesinger says European leaders "still have no way to connect a common currency with coordinated fiscal policy. Until (they) figure that part out, the Eurozone could encounter subsequent crises."
Worries about Europe's debt crisis and a weak U.S. economy dragged the S&P 500 down 19.4 percent between April 29 and Oct. 3. That put it on the cusp of what's called a bear market, which is a 20 percent decline.
Since then, there have been a number of more encouraging signs on the U.S. economy. Despite the jitters over Europe, many large U.S. companies have been reporting strong profit growth in the third quarter.
Dow Chemical rose 8.2 percent after its profit last quarter rose 59 percent on strong sales growth from Latin America. Occidental Petroleum Corp. jumped 9.7 percent after reporting a 50 percent surge in income.
Citrix Systems Inc. rose 17.3 percent. The technology company's revenue rose 20 percent last quarter, and it forecast growth of up to 13 percent for 2012. Akamai Technologies Inc., whose products help speed the delivery of online content, jumped 15.4 percent after the company reported earnings that beat analysts' expectations.
Avon Products Inc. fell 18 percent, the most in the S&P 500, after the company said the Securities and Exchange Commission is investigating its contacts with financial analysts and Avon's own probe into bribery in China and other countries.
Nine stocks rose for every one that fell on the New York Stock Exchange. Volume was heavy at 6.5 billion shares.