A trader wearing “Happy New Year” glasses works on the floor at the New York Stock Exchange in New York, on Monday, Dec. 31, 2012. The stock market struggled for direction Monday morning after five days of losses, with the “fiscal cliff” just hours away and lawmakers yet to reach a solution. (AP Photo/Seth Wenig)

If you’d told investors what was going to happen in 2012 — U.S. economic growth at stall speed, an intensifying European debt crisis, a slowdown in China, fiscal deadlock in Washington, decelerating corporate earnings growth — and asked how the stock market would perform, few would have predicted a good year.

But that’s just what they got.

The Dow Jones industrial average, the Standard & Poor’s 500 and the Nasdaq composite index all ended the year substantially higher, despite losing ground in the final days of year as concerns about the looming “fiscal cliff” mounted.

The Dow gained 7 percent for the year, its fourth consecutive annual advance, having started the year at 12,217. The S&P 500, which started the year at 1,257, is up 13 percent, beating the 7.8 percent average annual gain of the past 20 years. The Nasdaq also logged a better-than-average gain, 16 percent.

Including dividends, the total return on the S&P 500 index was even better: 16 percent.

Financial companies led the gains among S&P 500 stocks, advancing 26 percent, as banks continued their restructuring efforts after the recession. Bank of America more than doubled, gaining $6.05 to $11.61 and Citigroup advanced $13.25, or 50 percent, to $39.56. Utilities, the best-performing industry group last year, was the only sector of 10 industry groups in the index to decline, dropping 2.9 percent.

“There’s been a lot thrown at this market, and it’s proven to be very resilient,” said Gary Flam, a portfolio manager at Bel Air Investment Advisors in California. “Here we are at the end of the year, and it’s still relatively strong.”

Stocks started the year on a tear, with optimism about an improving job market and a broader economic recovery providing the backdrop to the S&P 500’s best first-quarter rally in 14 years.

The index advanced 12 percent by the end of March, closing the quarter at 1,408, its highest in almost four years, with financial companies and technology firms leading the charge. The Dow ended the first quarter at 13,212, logging an 8 percent gain.

Apple was one of the star performers of the first quarter and probably was the year’s most talked-about company.

At the start of the second quarter, the intensifying European debt crisis and concerns about the impact that it would have on global economic growth prompted a sell-off.

By the start of June, U.S. stocks had given up the year’s gains. The Dow fell as low as 12,101 June 4. The S&P dropped to 1,278 June 1.

The second quarter also was marred by Facebook’s disappointing initial public offering.

The stock sale was one of the most keenly anticipated initial public offerings in years, but investors didn’t “like” the $16 billion market debut. The social network priced its IPO at $38 per share, and the stock started to fall soon after the first day of trading on concern about the company’s mobile strategy.

Facebook closed as low as $17.73 on Sept. 4 before recovering some of the ground it lost to close the year at $26.62.

Company earnings reports also were starting to make uncomfortable reading for investors. Earnings growth for S&P 500 companies fell as low as 0.8 percent in the second quarter, according to S&P Capital IQ data.

Speculation that the Federal Reserve was set to provide the economy with more stimulus to prevent it from slipping back into recession also bolstered stocks.

By the time Fed Chairman Ben Bernanke announced Sept. 13 that the U.S. central bank would start a third round of its bond-purchase program, which is intended to push longer term interest rates lower and encourage borrowing and investment, the S&P 500 had surged 14 percent from its June 1 low. A day later, the index closed at five-year high of 1,466. The Dow Jones reached its peak close for the year of 13,610, Oct. 5.

As is often the case on Wall Street, investors “bought the rumor and sold the fact,” and quickly turned their attention to the challenges that lay ahead.

Analysts had also been cutting their outlook for growth in the final quarter of the year. At the start of the second quarter, estimated earnings growth for the period was 15.7 percent. That forecast had fallen to 3.4 percent by Dec. 27.

The year’s final twist came in Washington.

Stocks wavered ahead of a presidential election that at times seemed too close to call, and while President Barack Obama ultimately reclaimed the White House by a comfortable margin, the Republicans retained control of the House.

The divided government set the stage for a tense end to the year as Democrats and Republicans sought to thrash out a budget plan that would avoid the U.S. falling off the “fiscal cliff,” a series of tax hikes and government spending cuts that economists say would push the economy back into recession.

Initially, markets fell as much as 5 percent in the 10 days after the elections as investors worried that a divided government would not be able to agree on a budget plan to cut the U.S. deficit.

Although the S&P 500 managed to recoup those losses by December on optimism that a deal would be reached, some investors still urge caution. Any agreement will still be “ill-tasting medicine” to the economy, as it will almost certainly involve both spending cuts and tax hikes, said Joe Costigan, director of equity research at Bryn Mawr Trust Company.

“The question is, how much will the drag from the government be offset by business and personal spending,” said Costigan.

As you comment, please be respectful of other commenters and other viewpoints. Our goal with article comments is to provide a space for civil, informative and constructive conversations. We reserve the right to remove any comment we deem to be defamatory, rude, insulting to others, hateful, off-topic or reckless to the community. See our full terms of use here.

More in News

MONTREAT, N.C. (AP) — The Rev. Billy Graham, who transformed American religious life through his preaching and activism, becoming a counselor to presidents and the most widely heard Christian evangelist in history, died Wednesday. He was 99.

The Crosswinds school building in Woodbury could reopen as a science-focused magnet school with St. Paul Public Schools as its new owner. The St. Paul school board voted 5-2 on Tuesday night to buy the building from the state for $15.3 million. The deal closes Wednesday morning. The St. Paul district was a member of the cooperative that built Crosswinds...

It may have begun as a rumor, but now it’s officially a controversy. Members of the District 833 American Indian Parent Committee urged the South Washington County School Board last week to remove an Indian head mosaic at Park High School. The artwork was installed in 1965 in the east part of the main hallway near the school gym. They...

The parent group of Minnesota Public Radio is opening an innovation center — a testing lab and co-working space for startup ventures — in downtown St. Paul’s former Ecolab Tower on Wabasha Street. American Public Media plans to open the Glen Nelson Center in the recently renovated Osborn370 building this summer. Backed by philanthropic foundations, the center will invest in...

Sun Country Airlines is cutting 350 workers from its ground service operations at Minneapolis-St. Paul International Airport. The Eagan-based company told employees Tuesday it will contract those jobs out to Global Aviation Services Inc. Executives say the move will make Sun County more efficient. Layoffs begin immediately, with workers able to reapply for positions with Global Aviation as soon as...

The late Spiro Pina made Olympic history in 1994 when he became the first man to compete in luge for Greece. Pina, a native of St. Paul and a dual citizen of Greece and the U.S., returned to the Winter Olympics four years later, carrying the flag for Greece in Nagano, Japan. He placed 24th both years. Now his Olympic sled,...