NEW YORK — October is somewhat cursed for the stock market — the Crash of 1929, Black Monday in 1987, a slow-motion meltdown in 2008. This time, the demons made a last gasp, but Wall Street still managed to break the jinx.
Stocks had their best month in almost a decade, rising from their low point of the year in an almost uninterrupted four-week rally. The juice mostly came from Europe, which appeared to finally find a strategy for taming its debt crisis.
But the finish sure was ugly. The Dow Jones industrial average fell 276 points and finished below 12,000 on the final day of the month. It was as rough an end as it was a beginning: On the first trading day of October, the Dow lost 258.
Bank stocks were hit hard Monday. MF Global, a securities firm headed by former New Jersey Gov. Jon Corzine, filed for bankruptcy protection. Rating agencies downgraded the company last week, worried that it holds too much European debt.
Still, even counting the Halloween scare, October 2011 will be remembered on Wall Street for a comeback that only the St. Louis Cardinals, baseball's nearly eliminated, newly crowned champions, could match.
For the month, the Dow rose more than 1,000 points. It gained 9.5 percent, its best showing since October 2002. The Standard & Poor's 500 index, the broadest major market average, rose 10.8 percent for the month, the best since December 1991.
On Oct. 3, both the Dow and the S&P closed at their lows of the year. The market had been through a brutal summer and was one bad day away from falling into bear market territory, down 20 percent from its most recent peak.
Investors were worried that the United States, with an economy growing at the slowest pace since the end of the Great Recession, was on the brink of falling back into recession.
And if the U.S. didn't tip into a new recession by itself, the market was worried that Europe would give it a push. Greece and other European nations face crushing debt, and European banks that loaned them money face big losses.
A recession in Europe would be bad news for the United States because Europe buys about 20 percent of American exports.
Someone opening a quarterly account statement at about that time might have tossed it in the garbage and been afraid to look again. But that day was to be the turning point.
Reports that European leaders were working on a debt plan began trickling out. Investors gained confidence after the leaders of France and Germany pledged to come up with a far-reaching resolution by the end of the month.
Added to the encouraging news out of Europe: stronger corporate earnings from the likes of Google and McDonald's and signs that the U.S. economy was not as bad as feared. Retail sales rose 1.1 percent in September, the biggest gain in seven months.
When European leaders finally unveiled the deal Thursday, stocks roared higher. The S&P 500 jumped 3.7 percent and was up for the year for the first time since Aug. 3, just before the U.S. government's debt lost its AAA credit rating.
"It's a rally off what was a very pessimistic view of the global economy," says Todd Henry, an emerging-market equity specialist at T. Rowe Price. "Does it have legs? I think that's yet to be seen."
Under the debt agreement, banks will take a 50 percent loss on their Greek government bonds. Europe will also add money to a financial rescue fund to protect other countries. And banks will increase their capital reserves to protect themselves.
With the October books closed, the Dow was at 11,955.01, up about 83 percent from March 2009, its lowest point after the financial meltdown. It would have to rise more than 2,200 points from here to set an all-time high.
The S&P 500 finished the month at 1,253.50, down 32 points on Monday, or 2.5 percent. The Nasdaq composite index fell 53 points for the day, or 1.9 percent, and ended October at 2,684.