The S&P BSE benchmark Sensex snapped its 2-day losing streak, by recovering 33 points to close at 27,564.66 on fag-end buying from opreators ahead of the expiry of futures and options contract on Thursday.
Good foreign capital inflows coupled with higher opening in European markets also boosted the market sentiment.
The Sensex resumed lower at 27,447.40 and moved down further to 27,363.72 on profit-booking. However, it recovered afterwards to 27,595.80 before ending at 27,564.66, showing a marginal gain of 33.25 points or 0.12 per cent.
The Sensex had dropped by 426.09 points or 1.52 per cent in the previous two days.
However, the CNX 50-share Nifty continued to decline for the third day by slipping 4.75 points or 0.06 pct to close at 8,334.60.
Foreign portfolio investors bought shares worth a net Rs 114.81 crore on Tuesday as per provisional data while domestic institutional investors (DIIs) bought shares worth a net Rs 123.85 crore on Tuesday.
In the overseas market, Asian stocks ended mixed as key indices in China, Japan and Taiwan firmed up by 0.25 per cent to 0.63 per cent while Hong Kong, Singapore and South Korea fell by 0.60 per cent to 1.68 pct.
European markets were trading higher in their early trade amid the easing of tensions around the Greek situation.
Key benchmark indices in UK, France and Germany rose by 0.19 per cent to 0.63 per cent.
Mr. Jignesh Chaudhary, Head Of Research, Veracity Broking Services said," Initially indices started the day on a weak note & slipped down further following disappointing results by Tata Motors & Tech Mahindra dented the confidence of investors over the market, but ended slightly higher on fag-end buying from operators".
17 scrips out of the 30-share sensex pack ended higher while remaining 13 scrips finished lower.
Major gainers were BHEL (3.34 per cent), ONGC (2.70 per cent), Axis Bank (2.26 per cent), Coal India (2.11 per cent), Bharti Airtel (1.91 per cent), NTPC (1.66 per cent), HDFC Bank 1.32 per cent, SBIN (1.23 per cent), ITC (1.10 per cent), ICICI Bank (1.10 per cent), Tata Power (1.00 per cent) and Larsen (0.96 per cent).
However, Tata Motors fell by 5.12 per cent followed by M&M 2.80 per cent , Infosys 2.00 per cent, Sun Pharma 1.97 per cent, Gail 1.84 per cent, VEDL 1.69 per cent and Tata Steel 1.37 per cent.
Among the S&P BSE sectoral indices, Auto fell by 2.11 pct, IT 1.88 pct and Teck 1.42 pct while Bankex rose by 1.19 pct, Oil and Gas rose by 0.97 pct, Consumer Durable 0.95 pct and Power 0.58 pct.
Total market breadth cotninued to show negative trend as 1,435 stocks closed lower, 1,196 finished higher and 109 ruled steady. The total turnover rose further to Rs 2,769.66 cr from Rs 2,436.33 cr from Tuesday.