Weakening of the US dollar vis-a-vis other currencies and easing crude oil prices restricted the fall, forex brokers said.
The broader NSE Nifty briefly reclaimed the 12,000 level, before finishing at 11,966.05, showing a gain of 48.85 points, or 0.41 per cent.
The 30-share index rallied to trade 332.85 points, or 0.83 per cent, higher at 40,581.08 in afternoon session.
The fall in crude oil futures was mostly due to trimming of positions by traders, in line with weak global cues, analysts said.
The dollar index, which gauges the greenback's strength against a basket of six currencies, fell by 0.07 per cent to 97.91.
Tech Mahindra, Yes Bank, Infosys, Vedanta, M&M and L&T too fell up to 1.13 per cent.
US crude inventories rose by 4.3 million barrels in the week ended Nov 1 to 440.5 million barrels.
Forex inflows through Bajaj Finance share sale to qualified institutional investors helped the rupee hold strong, said analysts.
After swinging 413 points during the session, the 30-share Sensex settled 53.73 points, or 0.13 per cent, lower at 40,248.23.
Gold is trading at Rs 39,213 per 10 gram on Tuesday on rupee appreciation and selling in global markets.