Eurozone ministers have declared the end of the Greek debt crisis, agreeing debt relief and a big cash payout for the Mediterranean nation.
It is part of a broad bailout exit deal that will close eight years of financial rescues for cash-strapped Athens.
Greece is slated to leave its financial rescue on 20 August and finance ministers from the 19 countries that use the single currency were under pressure to offer Athens a goodbye deal that left it strong in the eyes of the financial markets.
"The Greek crisis ends here," said EU Economic Affairs Commissioner Pierre Moscovici, after marathon talks in Luxembourg.
"We finally got to the end of this path which was so long and difficult it is a historic moment," the former French finance minister said.
The agreement is an important turning point for the eurozone nearly a decade after Greece stunned the world with out-of-control spending and sparked three bailouts and a near collapse of the euro single currency.
The deal was expected to be an easy one, but last-minute resistance by Germany - Greece's long bailout nemesis and biggest creditor - dragged the talks on for six hours.
With writing-off loans off the table, eurozone ministers agreed to extend maturities by ten years on major parts of its total debt obligations, a mountain that has reached 180% of GDP - almost double the country's annual economic output.
The eurozone creditors also agreed to disburse €15bn to ease the country’s exit from its programme. This would leave Greece with a hefty €24bn safety cushion, officials said.
"I am happy," Greek Finance Minister Euclid Tsakalotos said after the talks.
But "to make this worthwhile we have to make sure that the Greek people see concrete results ... they need to feel the change in their own pockets," he added.
Key dates in Greece's debt crisis
Greece's latest €86bn programme was agreed in 2015 after six contentious months of negotiation, bringing the level of assistance received by Athens to €273.7bn since 2010.
The rescue loans came in return for hundreds of stringent reforms that landed like a rock on the Greek economy, which shrank by nearly 25% in just a few years and sent unemployment surging.
But after the pain, including wage and pension cuts and tax hikes, Greece's economy has stabilised and is expected to post moderate growth this year.
Greece however will remain under the watch of its creditors after the bailout and under stricter terms than for Portugal, Ireland and Cyprus following their respective bailouts.
New deal allows Greece to exit eight year bail-out programme pic.twitter.com/n5bbEqSy5G— RTÉ Business (@RTEbusiness) June 22, 2018
Under German demands, Greece's debt relief in the short-term will be conditional on the continued implementation of agreed reforms, which if successful could inject about €1bn to the government's underfunded budget every year.
"We will ensure that the pressure to implement further reforms remains strong ... in the medium and long term," said Austrian Finance Minister Hartwig Loger.
Opposite the hardliners were France and the European Central Bank, which argued that reduced debt was crucial in order for Greece to gain the trust of the markets.
The International Monetary Fund, led by Christine Lagarde, welcomed the debt relief, but cited reservations about Greece's obligations over the long term.
"In the medium term analysis there is no doubt in our minds that Greece will be able to reaccess the markets," Ms Lagarde said after the talks.
"As far as the longer term is concerned we have concerns," she added.
The reform-pushing IMF played an active role in the two first Greek bailouts, but took only an observer role in the third, in the belief that Greece's debt pile was unsustainable in the long term.