The rally was led by IT exporters of expectation of order inflows from Europe post the Greece bailout deal.
Further, rally in Chinese stocks for the third straight session post the rout last week also aided sentiment.
The 30-share Sensex ended up 300 points at 27,961 and the 50-share Nifty ended up 99 points at 8,460.
"The agreement reached between eurozone leaders and Greece over the debt bailout has definitely boosted sentiment. Further, the clouds of uncertainty on the currency front is receding and the stability in the euro currency will benefit India with inflow of funds," said Deven Choksey, MD, KR Choksey Securities.
In the broader markets, the BSE Mid-cap and Small-cap indices ended up 1.3-1.4% each. Market breadth was strong with 1,786 gainers and 1,011 losers on the BSE. Further, the government will release consumer price inflation index for June later today.
The Indian rupee was trading lower against the US dollar at 63.48 compared to the previous close of 63.39 on the back of dollar demand frmo importers and gains in American dollar against other global currencies.
Global Markets
Asian markets ended higher on Monday on the back of Greece debt bailout deal with Chinese shares gaining the most in the region to end 2.4% higher while Hong Kong's Hang Seng was up 1.3%.
Japanese shares also ended higher with benchmark Nikkei up 1.5% while Straits Times was up nearly 1%.
European shares continued to trade higher with stocks in Germany and France surging the most after eurozone leaders reached an agreement for a bailout package for Greece.
CAC-40 and DAX were up 1.5-1.8% each while FTSE-100 was up 0.6%.
Sectors and stocks
All sectoral indices on the BSE were trading in the green. BSE IT index was the top gainer up 1.7% followed by Healthcare and Auto indices among others.
IT shares firmed up on hopes of order inflows from Europe after the Greece bailout deal.
HCL Technologies which derives 33% of revenues from Europe gained nearly 4% while TCS, Infosys and Wipro ended up over 1.2% each. In the auto pack, M&M ended up 1.8%.
The company plans to raise up to Rs. 5000 crore through issuance of securities on private placement basis in local and global markets after an approval from its shareholders. Vedanta gained 1% while Cairn India ended up 1.8%. According to a top official from Vedanta, the company will be closing the merger deal with Cairn India by March 2016. Maruti was up up over 2% after foreign brokerage, CLSA maintained its buy call on Maruti Suzuki for target price of Rs 4,450 per share.
Capital Goods shares ended mixed on the back of weak IIP numbers. L&T ended down 0.7% while BHEL ended with marginal gains.
Gail has gained nearly 4% after media reports stated that the company has launched a tender to buy to liquefied natural gas (LNG) cargoes for prompt delivery, linked to demand for gas by various local fertiliser companies.
Among other shares, IndusInd Bank gained over 3% after the private lender posted a 25% rise in net profit for the first quarter ended June 30, 2015.
Net profit for the quarter stood at Rs 525.04 crore compared to Rs 421.06 crore in the same quarter last year.
Everest Industries gained 9% after domestic mutual funds hiked their stake in the company by over 1% in April-June quarter. Suven Life Sciences gained 7% after the company received patents by China, South Africa and Mexico for new chemical molecules that can be used in drugs for treating neuro-degenerative diseases.
Companies with exposure to Greece also ended higher. Bharat Forge, Cox & Kings and Motherson Sumi ended up 4.2-4.7% each.
Crime not suspected in New York Stock Exchange glitch: Source
Markets gain momentum ahead if CPI data; metals slip, IT climbs
Nasdaq at record high as Wall Street runs on strong data
China stock rout batters Asian firms linked to giant economy
'RIL, ONGC, SBI, BHEL, L&T could be out of Sensex in 10 years'