Eurozone finance ministers have agreed on a new bailout deal for Greece after Athens backed the plan.
European Commission President Jean-Claude Juncker said the deal sent a message "loud and clear" - Greece will stay in the eurozone.
The agreement demands tax rises and more tough spending cuts in return for Greece's third bailout in five years.
The deal means new loans of up to €86bn will be made available over the next three years.
The first tranche will be of €26bn - €10bn to recapitalise Greek banks and €16bn in several instalments, the first of which - €13bn - will be made by 20 August, when Greece must repay about €3.2bn to the European Central Bank (ECB).
The deal comes at a heavy political price for Greek Prime Minister Alexis Tsipras, who has faced a rebellion in his left-wing Syriza party.
More than 40 Syriza MPs voted against him when parliament decided on the bailout agreement on Friday, after all-night talks. Reports in Greece suggest he will seek a vote of confidence in parliament next week, bringing the prospect of snap elections closer.
Debt relief issue
Announcing the "comprehensive and ambitious reform package", Eurogroup chairman Jeroen Dijsselbloem said: "All the intense work of the past week has paid off.
"If implemented with determination, the deal will allow the Greek economy to return to growth."
He added: "Of course there were differences, but we have managed to solve the last issues."
Mr Juncker said: "The past six months have been difficult. They have tested the patience of policy-makers and they have tested the patience of our citizens even more.
"Together, we have looked into the abyss. But today, I am glad to say that all sides have respected their commitments."
He added: "The message of today's Eurogroup is loud and clear: on this basis, Greece is and will irreversibly remain a member of the euro area."
The deal rules out any "bail-in" of depositors' savings in Greek banks.
Greek Finance Minister Euclid Tsakalotos said the deal "takes Greece forward in the sense that the financial system should be much more stable from now onwards. There is a promise of recapitalisation of the banks, without any of the depositors having to bail in or anything to worry about."
There will have to be a series of votes in national parliaments across Europe to back the deal.
The BBC's Adam Fleming in Brussels says the finance ministers also confirmed that the thorny issue of writing off some of the Greece's debts would be considered in the autumn.
This has been a crucial demand of both Mr Tspiras and the International Monetary Fund.
IMF managing director Christine Lagarde said the deal was "an important step forward" but stressed again that Greek debt was "unsustainable" and that relief would be needed.
This could still prove to be a stumbling block to IMF participation, and Finnish Finance Minister Alexander Stubb said: "Some kind of solution will have to be found."
Arriving at the 19-member Eurogroup meeting in Brussels earlier, even German Finance Minister Wolfgang Schaeuble - one of Mr Tsipras's harshest critics - said he was optimistic about a deal.
Greek MPs backed the deal on Friday morning after a marathon all-night session marked by procedural delays and often angry exchanges in parliament.
The deal received:
- 222 votes for
- 64 against
- 11 abstentions
Third Greece bailout: What are eurozone conditions?
Thirty-one Syriza members voted "No", and 11 abstained - the biggest rebellion within Mr Tsipras's party so far.