Dow, S&P 500 close at 5-year highs

Dow and S&P 500
Click the chart for more stock market data.

U.S. stocks gained ground Tuesday, with the Dow and S&P 500 closing at fresh five-year highs amid mostly strong earnings reports.

The Dow Jones industrial average added 0.4% and S&P 500 rose 0.5%, advancing once again to their highest levels since December 2007. The two indexes have been hitting new highs since the start of the year.

Travelers (TRV) was among the best performers on the Dow, with shares rising more than 2% after the company's fourth-quarter profit beat estimates. Shares of DuPont (DD) also rose sharply after the company reported better-than-expected earnings and issued an upbeat outlook, helping boost the blue chip index.

Western Digital (WDC) was a big winner in the S&P 500. The data storage provider, which is slated to report earnings Wednesday, said it is expanding its products to to address the small and medium-sized business market.

The Nasdaq edged up 0.3%, fueled by an 13% jump in shares of Research in Motion (RIMM). The BlackBerry maker's stock has been gaining on the hype surrounding the launch of BlackBerry 10 later this month.

Dell (DELL) was also a big gainer on the tech-heavy index following reports that Microsoft (MSFT) was in talks with private equity firm Silver Lake Partners and Dell CEO Michael Dell to invest between $1 billion to $3 billion in the buyout of the PC maker, citing sources close to the matter.

Related: Microsoft buying a chunk of Dell would be smart (for Microsoft)

On the downside, Johnson & Johnson (JNJ) shares edged lower after the company reported earnings and sales that were roughly in line with estimates

Verizon (VZ) reported a wider quarterly loss ahead of the open, but shares gained ground. Wireless carriers are expected to have a rough quarter as profit margins get dinged by high subsidies paid to Apple (AAPL) for the iPhone 5.

After the closing bell, shares of IBM (IBM) climbed after the company topped fourth-quarter earnings and sales expectations and also issued a better-than-expected outlook for 2013.

Google (GOOG) shares also rose in after-hours trading after the company delivered earnings and revenue that exceeded forecasts.

Travelers insurance up despite Sandy
Travelers insurance up despite Sandy

Overall, S&P 500 companies are expected to report earnings growth of 3.8% for the last three months of 2012, according to S&P's Capital IQ.

Earlier in the day, stocks wavered as investors focused on mixed housing data. The National Association of Realtors said existing home sales surprisingly declined in December to an annual rate of 4.94 million from the previous month. Despite the month-over-month decline however, overall existing home sales in 2012 were the highest for the U.S. real estate market in five years, according to the industry trade group.

Related: Fear & Greed Index steeped in extreme greed

European markets and Asian markets ended mixed.

Japan's Nikkei ended narrowly weaker and the yen firmed slightly against the dollar after the Bank of Japan raised its inflation target and announced unlimited government bond purchases from next year. The move was widely expected and some analysts said the bank could have been even more ambitious in its bid to stimulate growth.

"Today's announcements do represent a significant step forward from the BoJ," analysts at Daiwa Capital Markets wrote in a note to clients. "Even if they are not necessarily the seismic shift in policy that the economy might require."

The dollar was also lower versus the euro and the British pound.

Oil and gold priced edged higher.

The price of the 10-year Treasury was little changed, and the yield held steady around 1.84%.

CNNMoney Sponsors