Fiscal cliff fears gave way to euphoria as Congress may have agreed on terms for a tentative deal and the news sent stocks soaring, despite an announcement later that the House would not vote tonight and that, therefore, the U.S. would technically go over the cliff, if temporarily.

The Dow Jones Industrials (^DJI -0.23%) soared 166 points, finishing the year with an 886-point gain, or about 7%, before considering the impact of dividends. The S&P 500 finished with a more impressive 13% gain for the year, besting last year's flat performance.

All 30 Dow stocks gained ground on the day, but the biggest gainers were predictably ones that have been most sensitive to the economy all year. Caterpillar (CAT 0.17%) jumped more than 3%, while General Electric (GE -3.24%) rose 2.7% and Bank of America (BAC -0.05%) added to its huge gains with another 2.2% advance. For B of A, another piece of good news comes from reports that it and other banks may be close to reaching a settlement with the Office of the Comptroller of the Currency to resolve mishandling of foreclosures during the mortgage crisis. Meanwhile, for Caterpillar and GE, news that manufacturing conditions in China have improved points to the possibility of better growth for the industrial giants in the coming year.

But the big winner of the day was Hewlett-Packard (HPQ -0.78%), which soared more than 4%. The company got good news when it held onto a Veterans Affairs Department contract worth more than half a billion dollars over protests from rival IBM that the department didn't appropriately consider other proposals. After reconsideration, though, the VA made no changes. Still, the longer-term question for HP is whether it can truly rebound from its horrific performance in 2012. If so, value investors could be rewarded for their courage.