The Nasdaq advanced on Wednesday, boosted by the tech sector's strength after solid earnings from Micron Technology and Red Hat.

But the Dow and the S&P 500 were flat to slightly higher in the wake of disappointing new home sales data.

Red Hat Inc gained 4.6 percent to $31.23 following third-quarter results that beat Wall Street's expectations, while Micron Technology Inc climbed 6 percent to $9.97 after posting its first quarterly profit in nearly three years. The Nasdaq's major gainers included iPod and iPhone maker Apple , up 0.8 percent at $201.97.

It looks like we are not cutting back on the iPhones, iPods, flat panels and gadgets as much as we are cutting back on travel, cars and all that other stuff, said Barry Ritholtz, chief market strategist at Fusion IQ in New York.

It seems gadgets and technology remain a reasonable way to get some bang for your buck in terms of gifts and personal things or whatever, but you just haven't seen that space do poorly.

In contrast, the Dow and the S&P 500 were little changed, as the indexes retreated from early gains after data showed new home sales fell unexpectedly in November.

On the last full trading day before the Christmas holiday, the Commerce Department said new home sales in November sank 11.3 percent to an annual rate of 355,000 units, a seven-month low. A recovery in the housing market is considered crucial for the U.S. economy to sustain its rebound from a severe recession. Thursday's trading will be an abbreviated session, ending at 1 p.m. for Christmas Eve.

The Dow Jones industrial average <.DJI> dipped 3.78 points, or 0.04 percent, to 10,461.15. The Standard & Poor's 500 Index <.SPX> gained 1.74 points, or 0.16 percent, to 1,119.76. The Nasdaq Composite Index <.IXIC> added 12.36 points, or 0.55 percent, to 2,265.03.

Home Depot Inc shed 1.5 percent to $28.86 and ranked as one of the worst drags on the blue-chip Dow.

The final December reading on consumer sentiment from the Reuters/University of Michigan surveys and November personal spending also came in weaker than expected.

The dollar lost 0.6 percent against a basket of major currencies <.DXY>, which lifted exporters such as Caterpillar Inc , up 0.4 percent at $58.09 and helped limit declines in the Dow and the S&P 500.

Energy stocks moved higher, as U.S. oil futures rose 2.8 percent, or $2.05, to $76.45 per barrel after data from the Energy Information Administration showed U.S. crude oil inventories fell more than expected last week as imports declined.

The PHLX Oil Service index <.OSX> shot up 1.8 percent, lifted by Schlumberger Ltd , which rose 2.7 percent to $65.72 after Barclays Capital raised its rating on the oilfield services company to overweight from equal-weight.