The BSE Sensex on Wednesday surged by 265 points to reclaim the 28,000-level, while Nifty settled at 8,523.80 -- its highest closing in nearly three months -- on hopes that the deal between world powers and Iran will lead to a rise in oil exports from the West Asian nation to India.
Moreover, continued buying interest by foreign investors too lifted market sentiment, traders said.
Foreign investors bought shares worth around Rs 270 crore on Tuesday.
Global crude oil prices fell after a deal was reached between six major powers and Iran on its nuclear programme. With this, Tehran would be able to boost its oil exports.
"Markets closed on strong note as international oil prices will come down with the imminent lifting of sanctions against Iran and India will be one of the beneficiaries," said Gaurav Jain, Director at Hem Securities.
Reaching to the news, the Sensex resumed higher at 28,022.14 and rose further to 28,218.37 before finishing at 28,198.29, showing a gain of 265.39 points or 0.95%.
The rally was led by auto, IT and teck stocks on the back of good foreign fund inflows even as global cues were mixed.
The 50-share NSE Nifty recaptured the 8,500-level and went up to hit the day's peak of 8,531.40. It finally settled higher by 69.70 points or 0.82% at 8,523.80.
This is the highest close since April 17 when the index ended at 8,606.
On BSE, country's biggest carmaker Maruti Suzuki hit an all-time high of Rs 4,182 before settling 2.63% higher at Rs 4,155.
Other blue-chips that supported the rally included Tata Motors, Wipro, TCS, M&M and Lupin.
Meanwhile, investors were keenly waiting for the US Fed Chair Janet Yellen's two-day testimony before the US Congress and voting on reform measures by the Greek parliament, both scheduled later in the day.
In overseas markets, European stocks reversed initial losses on expectations Greece's Parliament will approve a rescue deal. Key indices in the UK, Germany and France were up 0.01% to 0.10%.