The stock market shot higher on Monday afternoon, in the year's final hour of trading, signaling that investors believe the politicians in Washington will work out a budget compromise to avoid the "fiscal cliff."

At the closing bell on Wall Street, the Dow Jones industrial average was up 166 points at 13,104.1. The Standard & Poor's 500 index was up by 23.8 points at 1,426.2, and the Nasdaq composite was up 59.2 points at 3,019.5.

It was a high note in what had been a choppy day for the market, as choppy as the "fiscal cliff" deal-making that has been yanking it around.

The market's indecisiveness overlaid a day of dramatic budget negotiations in Washington. If Republicans and Democrats can't agree to a new budget deal by midnight, then higher taxes and lower government spending will automatically kick in Tuesday -- the so-called fiscal cliff.

Most economists say that would hurt the economy and could even send it back into recession. But what might hurt more, they add, is the psychological impact of knowing that the government can't agree on a budget.

"We're having a fragile recovery, with the pain of 2008 still fresh on everybody's mind," said Joe Heider, principal at Rehmann Group outside Cleveland. "It's fear of the unknown. And fear is one of the greatest drivers of the financial markets."

Tim Speiss, partner in charge of the personal wealth advisers practice at EisnerAmper in New York, followed the "cliff" talks on Monday and wondered if the U.S. debt rating would be cut again. The Standard & Poor's ratings agency cut the U.S. government's after ugly protracted talks on the government's borrowing limit in August 2011. S&P said at the time that the "political brinkmanship" highlighted how "America's governance and policymaking [is] becoming less stable, less effective, and less predictable." Its rating cut sent the stock market into a tailspin.

advertisement | advertise on newsday

The other major ratings agencies, Moody's and Fitch, have suggested that they might lower their U.S. ratings because of the fiscal cliff. "That is, unfortunately, the big story," Speiss said.

Some of the best-performing stocks for the year were those that had been hammered in 2011. Home builder PulteGroup, appliance maker Whirlpool and Bank of America all more than doubled over the year, after falling by double-digit percentages in 2011.

Some of the worst performers of the year were Best Buy, Hewlett-Packard and J.C. Penney. All are struggling to keep up with competitors who have adapted more quickly to changing technologies and changing customer tastes. They were all up Monday, but were each down at least 45 percent for the year.