The Sensex, which commenced the day on a weak note at 25,861.47, slipped further to touch the day's low of 25,791.79 after investors focussed on weak economic data.
However, late buying by overseas funds helped the 30-share index rebound and close with a gain of 38.18 points, or 0.15 per cent, at 25,918.95.
This is the best closing since July 30 when Sensex had closed at 26,087.42.
The gauge has now gained 590 points in three sessions.
"Intra-day volatility remained high as indecision and profit booking continued at higher levels. Despite overall negative bias, buying was seen in IT and Healthcare stocks on a weaker Indian rupee. Positive Asian cues further strengthened sentiment," said Nidhi Saraswat, Senior Research Analyst, Bonanza Portfolio Ltd.
Country's industrial production slowed to 3.4 per cent in June as against 5 per cent in May, while retail inflation rose to 7.96 per cent in July from 7.46 per cent in June.
The broad-based National Stock Exchange index Nifty rose 12.50 points, or 0.16 per cent, to 7,739.55 after shuttling between 7,695.70 and 7,757.10 on alternate bouts of selling and buying by participants.
In the 30-share Sensex pack, 14 stocks gained while 16 ended with losses.
Stocks of Sun Pharma gained 2.09 per cent after the company posted a consolidated net profit of Rs 1,390.51 crore for the first quarter ended June 30.
Other major gainers were HDFC, ITC, Infosys, Reliance Industries, Sesa Sterlite, TCS, Wipro and Bajaj Auto.
However, shares of state-run BHEL plunged 6.57 per cent after company's net profit shrunk to Rs 193.50 crore for the quarter ended June 30, 2014.
Sectorally, the FMCG sector gained the most by rising 2.22 per cent, followed by IT index (0.76 per cent), Healthcare index (0.75 per cent) and Oil and Gas index (0.17 per cent).