Gaining the most in more than a week, the BSE Sensex added 330.71 points, or 1.31 per cent to end at 25521.19. The broader National Stock Exchange's Nifty closed at 7,631.7, up 98.15 points, or 1.3 per cent, best single-day gain since June 6.
Ignoring tensions in Iraq and the flare-up in oil prices, shares of oil and gas companies rallied sharply with the country's biggest oil explorer Oil & Natural Gas Corporation (ONGC) gaining 4.43 per cent to Rs 445.8. Index heavyweight Reliance Industries gained 2.61 per cent to Rs 1,093.3.
Analysts said the gains could be on expectations of margin expansion after a surge in international oil prices. Brent crude futures was trading around its nine-month high level at $113 a barrel on concerns over disruption in oil supply due to deepening conflict in Iraq and a gas dispute between Ukraine and Russia.
"Oil reforms, including diesel price deregulation and gas price hike, are expected to come through in the near term. The primary beneficiaries of diesel price deregulation will be ONGC, Oil India, HPCL, BPCL and IOC," said Amar Ambani, head of research at domestic brokerage IIFL.
"Market buzz was that European funds, two in particular, were active on banking and oil stocks," he said.
"The (market) rise was surprising and likely a result of some fund buying in the large cap stocks. The markets had consolidated over the past couple of trading sessions," said Dipen Shah, head of private client group research, Kotak Securities.
Foreign investors have been actively buying Indian stocks this year, pumping almost $10 billion so far in 2014.
Unperturbed by rise in inflation and delay in rate easing cycle, banking stocks too gained on Tuesday. Most leading banking stocks, such as State Bank of India and ICICI Bank gained two per cent each, while Axis Bank gained the most at a little over four per cent.
"We believe, fundamentally, markets will be guided by the inflation trajectory in the medium term and the Budget policy document in the near term...lower inflation and a softer monetary policy are a necessity to economic recovery," wrote Edelweiss in its strategy report.
The brokerage said Prime Minister Narendra Modi's statement that the country has to swallow a bitter medicine to set the economy on the right path was "reflective of what to expect from the Budget" and should be viewed positively.