Eurozone leaders have reached a compromise deal that could secure Greece a third bailout.
After a marathon 15 hours of talks in Brussels, probably the longest EU summit on record, Charles Michel, the Belgium prime minister, tweeted the word "Agreement".
Donald Tusk, the president of the European Council confirmed the agreement soon afterwards.
Eurozone leaders had burnt the midnight oil over Greece with Alexis Tsipras, the Greek prime minister, holding out in the face of demands Greece give up a good deal of Greece's sovereignty.
He was understood to be holding out over two central issues - the involvement of the International Monetary Fund (IMF) in a proposed three-year bailout, and a German proposal that Greece put €50 billion of state assets in a fund to be externally managed and serve as collateral for new loans.
That measure in particular is controversial.
The Greek government believes it is designed to humiliate the ruling Syriza coalition after Mr Tsipras angered the country's creditors by calling a referendum on earlier bailout terms and encouraging Greeks to vote against them.
Any new deal is likely to involve a series of commitments from Mr Tsipras to push through a reform plan in the next few days.
The Greek parliament would need to endorse the package today and pass legislation to implement it by Wednesday before talks on a bailout can get under way.
To do it, Tsipras might have to reshuffle his cabinet to remove ministers who might vote against the measures, raising the issue of political discord in Athens.
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies