Eurozone leaders have reached a "unanimous" agreement over a third Greek bailout after marathon talks.
EU chairman Donald Tusk said leaders agreed "in principle" on negotiations for the bailout, "which in other words means continued support for Greece".
"There will not be a 'Grexit'," said European Commission head Jean-Claude Juncker, referring to the fear that Greece would have to leave the euro.
Greece will now have to pass reforms demanded by the eurozone by Wednesday.
Prime Minister Alexis Tsipras told reporters that Greece had fought a "tough battle", won debt restructuring, and sent a message of dignity to all of Europe.
"The deal is difficult but we averted the pursuit to move state assets abroad," he said. "We averted the plan for a financial strangulation and for the collapse of the banking system."
Jeroen Dijsselbloem, the head of the eurozone group of finance ministers, said the agreement included a €50bn (£36bn) Greece-based asset fund, of which €25bn would be used to recapitalise Greek banks.
Parliaments in several eurozone states have to approve any new bailout.
"The road will be long, and judging by the negotiations tonight, difficult," German Chancellor Angela Merkel said on Monday morning.
Eurozone leaders had been meeting in Brussels for about 17 hours, with talks continuing through the night.
During the night, reports emerged that Greece was holding out over the proposed role of the International Monetary Fund (IMF) in a new programme, and over the fund to hold Greek assets.