The last time the stock market was this high, the Great Recession had just started, and stocks were pointed toward a headlong descent.
But on Thursday, the Dow Jones industrial average hit its highest mark since December 2007, and the Standard & Poor's 500 index soared to its highest level since January 2008 in a rally that marked a milestone: American stocks have come almost all the way back.
A long-anticipated plan to support struggling countries in the European Union provided the necessary jolt, and the gains were extraordinarily broad. All but 13 stocks in the S&P index were up. European markets surged, too.
"There's just a sea of green," said JJ Kinahan, TD Ameritrade's chief derivatives strategist. "It's pretty fun."
At the start of 2008, the U.S. economy was already a month into recession, though most people scarcely knew it at the time. The S&P had recently hit an all-time high, and the unemployment rate was 5 percent, compared with the current 8.3 percent.
Then, in March 2008, the investment bank Bear Stearns collapsed under the weight of bad mortgage bets, and investors began to sell. In September, the full financial crisis took hold as Lehman Brothers filed for bankruptcy, banks stopped lending to each other and investors began dumping stocks in earnest.
By March 2009, the S&P had dropped 57 percent from its high to hit a 12-year low of 676.
Since then, the index has been on an impressive if often bumpy climb. Helping to power it was unprecedented support from the Federal Reserve, which critics say has reignited a dangerous gambling spirit among professional investors, and record profits at big U.S. companies.
Although stocks have rebounded, the broader economy is still lagging. But Barry Knapp, head of U.S. equity strategy at Barclays Capital, said stocks tend to anticipate the future economy rather than reflecting current conditions. So the signs are good.
"It can be a misleading forecasting tool, but sometimes it's telling you something significant," he said. "It's entirely possible the stock market is telling us that there is a better economic environment out there."
So could the rally help President Obama? A number of recent studies have connected a rising stock market to improved odds of re-election for the incumbent president. Since 1900, when the S&P 500 has posted gains from July to October in an election year, voters returned the sitting president to the White House 80 percent of the time, according to a study by S&P Capital IQ.
But no modern president has faced re-election when unemployment was so high. President Jimmy Carter was bounced from office in 1980 when unemployment was 7.5 percent.
If you started off 2008 by putting $10,000 in the S&P 500, the benchmark for most stock funds, you would now have $10,600, thanks to dividends. That's assuming you could stomach the ride. Your initial investment fell to $9,840 six months later, then plunged to $6,300 by the following January.
Starting in 2010, companies began generating higher and higher profits despite an anemic U.S. economic recovery. In fact, companies in the S&P 500 increased net income by double-digit percentages over eight quarters in a row through the end of last year — a stretch that has surprised even Wall Street stock analysts, who are normally criticized for being too optimistic.
The way companies achieved that is familiar to any of the millions of Americans who've lost a job in recent years: Businesses cut workers, used technology to run more efficiently, slashed spending and squeezed remaining staff.
Sales to faster-growing countries in Asia also helped. Companies in the S&P 500 now generate 30 percent of their sales from overseas, Knapp said.
The market's rise did hit a few roadblocks, however, most notably in the summer of 2011, when Congress was squabbling over raising debt limits and fear was mounting that the U.S. could be headed into another recession.
Over one four-day stretch in August, the Dow rose or fell by 400 points each day, the first time that has happened. The S&P 500 ended flat for 2011.
Then earnings rose again this year, fears over European debt crisis receded and stocks soared again. For the first three months of 2012, the Dow was up 8 percent and the S&P 12 percent, in each case the best start since the great bull market of the 1990s.
The question now is whether big companies can continue to post record profits. The immediate outlook has no shortage of potential obstacles.
The U.S. economy grew a tepid annual rate of 1.7 percent in the April-June period, less than half the pace of late last year. Big overseas economies, like Brazil's and China's, are slowing. And many countries in the 17-nation eurozone are in recession.
On Thursday, the chief economist of the Organization of Economic Cooperation and Development said he expects even powerhouse Germany to fall into recession by the end of the year.
As if that's not bad enough, the dollar has strengthened against major currencies recently. That makes U.S. products sold in foreign currencies more expensive, cutting into overseas revenue.
Thursday's rally got momentum after the president of the European Central Bank unveiled a new program to buy government bonds from the region's struggling countries with the aim of lowering their borrowing costs. Mario Draghi said the program will have no set limit on how much it can buy.
That was just what investors needed to hear. The S&P 500 index jumped 28.68 points, to 1,432.12. The Dow Jones industrial average surged 244.52 points, to 13,292.
The NASDAQ composite index also reach a milestone, gaining 66.54 points, to close at 3,135.81, its highest level in 12 years.
Germany's DAX and France's CAC-40 each rallied 3 percent. The gains were even bigger in Spain and Italy, the two largest countries to become caught up in the region's long-running government debt crisis. Spain's benchmark index soared 5 percent, Italy's 4 percent.
Traders shifted money out of U.S. Treasury bonds, considered one of the world's safest places to stash money, and the drop in demand lifted yields. The yield on the 10-year Treasury note rose to 1.67 percent, up from 1.60 percent late Wednesday.
In an encouraging sign for the American job market, a report from the payroll processor ADP said businesses added 201,000 jobs last month, the most reported by the survey since March.
Separately, the Labor Department said the number of people applying for unemployment benefits fell by 12,000 last week to 365,000. That figure won't affect the August jobs report, due out Friday, but could be a sign of a better hiring this month.
Even before Thursday's surge, the stock rally has been one for the record books.
Jim Paulsen, chief investment strategist at Wells Fargo Capital Management, published a report last month showing that stock prices have more than doubled in the 3 ½ years since hitting a recessionary low in March 2009. That surpasses every post-World War II rally after a recession over a similar period.
"We've been told from the start that this stock market was going to be low return and high risk, but it's turned out to be the best ever," Paulsen said Thursday. "Fear was way overdone."