Snapping a six-day losing streak, the S&P BSE Sensex ended marginally higher on Tuesday, gaining 31 points led by positive global cues and increased buying of oil and IT stocks.

The Sensex closed at 26,590 points, up 0.12%, while the 50-share Nifty rose 10 points, or 0.12%, to end at 8,060.

Although domestic stock markets rebounded sharply in the morning session, supported by a rally in Asian markets, profit booking at higher levels led the markets to erase most of the gains later.

The Sensex touched an intra-day high of 26,732 and a low of 26,514 during the session.

Worries over mixed corporate earnings for the second quarter and caution ahead of counting for the Bihar Assembly elections also pressured the markets.

"The trend is expected to continue, and thus markets are to remain volatile. With the festive season round the corner, some bounce-back can be expected if Nifty manages to hold onto 8,015 on spot on closing basis while a move above the zone of 8,080-8,115 would confirm it for a rally towards the 8,238-8,429 zone," Business Standard quoted Ranak Merchant, Technical Analyst - Strategies of Sushil Financial Services, as saying.

Among the BSE sectoral indices, IT, Oil & Gas, and Power were the top gainers, while Consumer Durables and Capital Goods ended as top losers.

Stocks prices of domestic engineering company Larsen & Toubro (L&T) extended losses for the 11th straight session, ending 1.1% lower, led by the company's disappointing earnings for the September quarter and a sharp reduction in its order inflow guidance.

TVS Motor Company shares closed 4.8% higher after the company posted 14% increase in its sales for October.

NTPC, ONGC, M&M, Hindalco and Vedanta were the top gainers among the Sensex stocks. Lupin, Tata Motors, Bharti Airtel and Tata Steel were the major losers.

On the commodities front, gold prices fell sharply by Rs 110 to end at Rs 26,700 per 10 grams at the bullion market amid weakness in metal prices in the overseas market. Silver prices also dropped Rs 250.