Euro zone leaders meeting in Brussels on Sunday hammered out a third bailout deal for Greece, after 22 hours of acrimonious negotiations between the currency union's leaders and finance ministers.
Under the agreement, the Euro zone would give Greece up to €86 billion ($96 billion) in fresh bailout loans, on the condition that the government of Prime Minister Alexis Tsipras manages to implement a round of harsher austerity measures in days ahead.
The rescue deal comes after the Greek left-wing government's near-total surrender to its creditors' demands – and the EU's continued support for Greece is based on an ''in principle'' agreement on negotiations for the bailout.
While the deal is a hard one, it would help the country cling on to the euro and send a message to investors that things can still improve.
Tsipras warned that the agreed measures were recessionary although it helps keep a 'Grexit' off the table, for now.
The deal is on condition that Athens' Parliament passes pension overhauls and sales tax increases that voters overwhelmingly rejected in a referendum only last week.
Greece should also implement European Union rules that make it easier to wind down broken banks, including by sharing the cost with investors and creditors.
Tsipras has time till Wednesday to get the new conditions passed in the parliament.
However, euro zone governments have agreed to consider measures to make Greece's debt more manageable, by giving it more time to repay rescue loans.
"The agreement was laborious. It took time but it was done," said Jean-Claude Juncker, the president of the European Commission. But Juncker rejected suggestions Greece had been pressured into a deal.
"In this compromise, and it is a compromise, there are no winners or losers. I don't think the Greek people have been humiliated," Juncker said.
"There won't be a Grexit," Juncker added, referring to a Greek exit from the euro zone.
Once these measures are implemented, the EU will negotiate a detailed rescue programme that will contain measures that go far beyond the kind of oversight and external control.
Greece's creditors will demand the creation of a fund that would hold some €50 billion in state-owned assets slated to be privatized or wound down in the coming years. The fund will be in effect be managed by European creditors.
"Trust needs to be restored," German Chancellor Angela Merkel said at a news conference.
Most of the money raised will go to pay off Greece's debt and help recapitalise its broken banks, while €12.5 billion can be used for investment, said Merkel.
"The advantages outweigh the disadvantages," she said about the deal, while warning that Greece's path back to growth will be long and arduous.
Despite these big concessions by Tsipras, Greece's future in Europe's currency union still hangs in a balance.
The bailout still has to face the test of Greek parliament, which may reject the tough new measures and could split Syriza and its right-wing coalition partner, the Independent Greeks, which in turn could trigger fresh elections.
Greece's banks are still closed and it is still not known how Greece will make a €4.2-billion payment to the European Central Bank on 20 July.
The euro zone's finance ministers are yet to work out a mechanism to meet Greece's short-term financial needs "as a matter of urgency," Donald Tusk, the president of the European Council who led the talks, said after the summit.
European stocks rallied early on Monday on the news. By mid-morning, the Stoxx Europe 600 was up 1.5 per cent. Germany's DAX rose 1.4 per cent, France's CAC-40 added 1.9 per cent and London's FTSE 100 rose 0.6 per cent. In southern Europe, Italy's FTSE MIB climbed 1.2 per cent and Spain's IBEX gained 1.5 per cent.