Trade data for the month of January showed India posted its second highest ever monthly trade deficit of $20 billion, worsening from a $17.7 billion deficit in December, piling pressure on a widening current account deficit and limiting scope for the Reserve Bank of India to cut interest rates.
The Sensex ended the day at 19,608.08, up 47.04 points, or 0.24 per cent, while the Nifty closed at 5,932.95, 10.45 points, or 0.18 per cent, higher.
The gains mark a recovery from an eight-session losing streak that had sent the benchmark Sensex to its lowest level since December 31, 2012.
Earlier in the day, realty and infotech stocks led a surge in both the Sensex and the Nifty, which saw Tata Consultancy Services hit a record high of Rs 1,441.65 on the NSE after industry body Nasscom forecast that software exports would grow in the next fiscal year. While the Sensex touched a day's high of 19,723.01, the Nifty clocked a high of 5,969.50 today.
Other software services exporters also gained. Infosys shares rose 1.2 per cent, while HCL Technologies ended up 4.6 per cent.
Shares in Tata Motors gained 2.1 per cent after luxury unit Jaguar Land Rover (JLR) posted a surge in both wholesale and retail sales last month.
Oil and Natural Gas gained 1.1 per cent, clocking a second day of gains after quarterly earnings beat estimates on Monday.
Shares in Motherson Sumi Systems surged 6.7 per cent, a day after posting a recovery in quarterly earnings and ahead of a planned stake sale that traders say could happen at a premium.
Among decliners, State Bank of India fell 1.8 per cent on speculation the country's biggest public sector bank could report higher-than-expected bad loans when it unveils October-December earnings on Thursday.
Shares in Tata Steel ended 2.3 per cent lower ahead of its December quarter earnings on worries the steel maker would post a net loss. The company after market hours reported a net loss of Rs 763 crore.
Kingfisher Airlines ended 5 per cent lower, its maximum daily limit, after lenders said they would initiate recovery proceedings against the carrier.
Realty major Unitech, which bounced back in the first half of trading, pared its gains to end on a flat note at Rs 28.75, after touching a day's high of Rs 30.80. The stock traded 7 per cent higher earlier today after closing down 18 per cent on Tuesday. DB Realty shares plunged 17.57 per cent to close at Rs 83.25.
G. Chokkalingam, executive director and chief investment officer at Centrum Wealth Management, told NDTV Profit that he expects the markets will go up after a consolidation, with the Nifty gaining ahead of the Budget.
All eyes are now set on the WPI inflation data, shcheduled to be announced tomorrow, which likely eased to 7 per cent in January -- its lowest level in over three years -- due to a smaller rise in prices for manufactured goods, according to a Reuters poll. However, it still remains well above the RBI's perceived comfort zone of around 5 per cent.
With inputs from Reuters