The Dow is 6.5 percent higher this month; the S&P 500 is up 5.7 percent. Both are at the highest levels in more than five years.
Pfizer was the biggest gainer in the Dow, advancing 86 cents, or 3.2 percent, to $27.70 after the company said its fourth-quarter profit more than quadrupled because of a $4.8 billion gain from selling its nutrition business and despite competition from generic drugs hurting sales.
Home builder D.R. Horton gained $2.51, or 11.8 percent, to $23.82 after it said that net income more than doubled as the housing recovery took hold. Improving home prices and better sales bolstered profits.
"The earnings season is not stellar, it's not gangbusters, but it's better than last quarter," said Quincy Krosby, a market strategist at Prudential.
Analysts expect 2012 fourth-quarter earnings to increase by an average of 4.7 percent for S&P 500 companies, according to the latest data from S&P Capital IQ. That's an improvement on the previous quarter, when profit grew by 2.4 percent.
Valero Energy, a refinery operator, was the biggest gainer in the S&P 500. The company's stock climbed $4.96, or 13 percent, to $43.77 after it said its fourth-quarter profit soared on higher refining margins as it swapped out foreign crude for cheaper domestic oil.
Investor optimism was checked by a report that showed U.S. consumer confidence sank in January to the lowest level in more than a year as Americans fretted about the economic outlook and higher Social Security taxes. Stocks also failed to get much of a lift from a report published before the market opened that showed the U.S. housing market is sustaining its recovery.
"The turnaround in the housing market is for real," said Peter Cardillo, chief market economist at Rockwell Global Capital, adding that the decline in consumer confidence will likely prove to be temporary as home prices rise. He predicted that the S&P 500 might climb as high as 1,575 this quarter as investor optimism about the economic recovery grows.
The Federal Reserve started a two-day meeting Tuesday. Investors will be looking at the release of their statement Wednesday for clues about the outlook for the economy and interest rates.
The yield on the 10-year Treasury note rose by four basis points, to 2 percent. The yield, which moves inversely to its price, is at its highest level since April.