Indian stock markets extended their record-setting rally to an eighth consecutive session on Tuesday. The BSE Sensex gained as much as 340 points to a record high of 29,618.59, while the 50-share Nifty scaled the 8,900 peak for the first time.

The BSE Sensex is now eying the psychological 30,000 mark, having gained over 2,200 points or 8 per cent since January 15, when the Reserve Bank cut the repo in a surprise move. Huge buying by foreign investors and the "feel-good" factor arising from President Barack Obama's India visit are other factors driving Indian stocks higher, analysts say.

Former Tata Sons Chairman Ratan Tata, who was among the handful of industry leaders to interact with President Obama, tweeted, "Wonderful to see US & India come together in a bond of mutual friendship and trust. Both charismatic leaders deserve great credit and praise."

(Also read: Whose Line is it Anyway? That's More Than 70 Billion Dollars)

Noted economist Moses Harding tweeted, "##NaMo optimism extends to #NamObama euophoria as two major growth economies come together for mutual economic (and social) well-being!"

Market analysts were particularly optimistic about the "breakthrough" achieved in the civil nuclear deal, which could open the door for US companies to build nuclear reactors in the country. The nuclear deal is aimed at unlocking billions of dollars in nuclear trade and deepening defence ties, analysts say.

Larsen & Toubro shares came close to hitting their all-time high on Tuesday. The stock ended 1.6 per cent higher at Rs 1,739.40. Other defence-related shares such as BEL and BHEL also saw buying interest.

However, some analysts were careful in attributing the rally to President Obama. TS Harihar of HRBV Client Solutions said, "In terms of euphoria and feel-good factor, it (President Obama's visit) was great, but in terms of tangibles, I am not sure what the outcome of the visit is."

President Obama's $4 billion pledge for India was "substantially" lower than what Japanese and Chinese premiers had committed, when they visited the country, he added.

On Monday, President Obama had announced $4 billion in government-backed investments and lending to India - $1 billion would be used to finance exports of 'Made-in-America' products, while another $1 billion will be made available to small- and medium-sized enterprises in underserved rural areas of India. Investment worth $2 billion will be committed for renewable energy, he told a gathering of 50 odd business leaders. (Read the full story here)

Overseas investors also continued their buying spree. Foreign institutions have bought shares worth over $1 billion this year so far. Expectations that a major portion of the hundreds of billion in new money pumped into the euro zone economy will find its way into emerging markets is driving gains in Indian stocks, said Angel Broking.

The Sensex closed 292 points higher at 29,571, while the Nifty ended 75 points higher at 8,910. Both the indices closed at their all-time highs for a fifth consecutive session.

(With inputs from agencies)