NEW YORK (Reuters) - U.S. stocks eked out a slight gain on Wednesday, as advances in some major technology stocks offset losses in energy and helped keep major indexes just above the unchanged mark.

The S&P technology index was up 0.2 percent and managed to snap a five-session losing streak, its longest since April. The sector was buoyed by gains in Facebook, up 0.9 percent, and Microsoft, up 0.4 percent.

“Tech is very elevated,” said Stephen Massocca, Senior Vice President at Wedbush Securities in San Francisco.

“Tech has been down a little bit but if you look at the heart of the beast, the juicy stuff, it hasn’t really gotten hurt.”

Trading volumes remained muted in the holiday-shortened week between Christmas and New Year. Volume on Tuesday was the thinnest of the year for a full session.

The Dow Jones Industrial Average rose 28.09 points, or 0.11 percent, to 24,774.3, the S&P 500 gained 2.12 points, or 0.08 percent, to 2,682.62 and the Nasdaq Composite added 3.09 points, or 0.04 percent, to 6,939.34.

Oil prices dipped after hitting a near two-and-a-half-year high in the previous session, pushing down the S&P energy index by 0.3 percent.

ConocoPhillips, off 1.1 percent, and Chevron down 0.3 percent, were the biggest drags on the index.

Housing stocks edged up 0.1 percent after data showed contracts to buy previously owned homes edged higher in November, the latest signal the housing market may have regained some momentum.

Tesla shares fell 1.8 percent after brokerage KeyBanc lowered its estimate for Model 3 deliveries to roughly 5,000 units from 15,000 units for the fourth quarter.

Shares of wireless-charging technology developer Energous Corp surged 168.1 percent to $23.70 after it got certification for its wireless charging transmitter.

Advancing issues outnumbered declining ones on the NYSE by a 1.23-to-1 ratio; on Nasdaq, a 1.04-to-1 ratio favored advancers.

The S&P 500 posted 29 new 52-week highs and three new lows; the Nasdaq Composite recorded 86 new highs and 18 new lows.

Volume on U.S. exchanges was 4.36 billion shares, compared to the 6.79 billion average for the full session over the last 20 trading days.