It also got another injection of 15 billion euros under the deal.

Eurozone nations have agreed on the final elements of a plan to get Greece out of its eight-year bailout programme and make its massive debt more manageable.

The finance ministers of the 19 nations took day-long talks into Friday morning and reached a surprisingly hard-fought compromise which had seemed within easy reach for the past few days.

The ministers needed to finalise a deal between Greece and its international creditors that would allow it to safely emerge from its third and final bailout program on August 20 and face the markets again.

A new chapter is opening for Greece.This is the result of both national reforms and support from EU partners.The sacrifices and efforts of the Greek people in undertaking these reforms have delivered real, tangible results. pic.twitter.com/VB8gI9QPxI

“It took a bit longer than we expected, but ended in a very good way,” Greek finance minister Euclid Tsakalotos said. “I think it is the end of the Greek crisis … a historic moment.”

Mr Centeno said that under the deal, Greece could delay back repayment on billions in loans by 10 years, giving it a financial breather, while stricter deadlines could have further choked the economy over the next decade.

Greece had already got some 275 billion euros (£232 billion) in financial support from its international creditors over the past eight years. Over those years, Greece twice got perilously close to being kicked out of the eurogroup, EU Commissioner Pierre Moscovici said.

Greece has needed massive financial aid from eurozone nations and international creditors to survive financially for the past eight years.