Pro-Euro Greeks Stage Rally in Athens [Representational image]Reuters

After prolonged discussions that went on for about 17 hours, the eurozone leaders have agreed to bailout debt-ridden Greece for the third time.

"EuroSummit has unanimously reached agreement. All ready to go for ESM program for Greece with serious reforms and financial support," EU President Donald Tusk tweeted.

The Greek government now has to pass the reforms mandated by the eurozone leaders by Wednesday to receive the bailout funds.

"There will not be a 'Grexit'," European Commission head Jean-Claude Juncker told BBC.

Following a no-vote by the Greek voters to the conditions set by the lenders in the referendum held on 5 July, concerns over the country leaving the single currency zone have intensified.

However, as per the process, the new bailout amount should be approved by parliament of some leading eurozone countries.

"The decision gives Greece a chance to avoid the social (and) political consequences of a negative outcome," The Australian quoted Tusk, as saying.

"There are strict conditions to be met," he said.

The new bailout worth about €86 billion ($96 billion) will cover the financial needs of Greece for the next three years.

The fund will also recapitalise the struggling Greek banks. Without the deal, Greek banks would have run out of cash in the next few days.

Reacting to the deal, the global stock markets, including Indian benchmark Sensex, rose sharply. The BSE index soared over 320 points to trade at 27,989.29.

"But unless the new deal includes a substantial restructuring of Greek debt - which is unlikely - Greece's future inside the euro-zone remains under huge doubt," Capital Economics said in a note.