Eurozone finance ministers have agreed to extend Greece's rescue loans - although not by as long as the government wanted.
The deal, which will enable Athens to continue paying its bills, was reached at talks in Brussels which were delayed for four hours as ministers worked on a draft accord.
Jeroen Dijsselbloem, the eurozone's top official and the Dutch finance minister, said Athens had asked for a six-month extension but this was rejected.
"Four months is the appropriate delay in terms of financing and future challenges," he said.
The agreement was clinched just a week before Greece's €240bn (£178bn) bailout expires, leaving just enough time for some member country parliaments to endorse it.
As part of the deal Greece must provide a list of economic and other reforms based on the current bailout programme by Monday.
This will be reviewed on Tuesday by the European Central Bank (ECB), the International Monetary Fund (IMF) and the European Commission.
If the three institutions do not believe the proposals go far enough, the list will be revised with a view to it being agreed by the end of April.
Greek Finance Minister Yanis Varoufakis said the deal would mark a new era for Athens and its relations with the European Union.
"Today was a pivotal moment because Greece for five years now has been lonely, isolated in the Eurogroup. Today that isolation has broken," Mr Varoufakis said.
He said Greece had not used any threats or bluff to get the agreement and added it was a small step in a new direction for the country.
Markets reacted positively to the deal, with the Dow and S&P 500 surging to fresh records on Wall Street.
Mr Dijsselbloem said it was a "first step in this process of rebuilding trust" between Greece and its euro partners and allows for a strategy to get the country "back on track."
"Trust leaves quicker than it comes," he said.
Mr Dijsselbloem worked flat out on Friday to secure an agreement as Germany insisted Greece stick with the austerity commitments included in its bailout programme.
The fraught discussions focused on a new package of concessions beyond those contained in the formal request for a loan extension submitted on Thursday.
Greece has ruled out another bailout like the existing one, saying the people who swept the anti-austerity Syriza party to power last month would not tolerate it.
1/20
-
Gallery: Art War On The Streets Of Athens
Athens has become a Mecca for street artists as anger grows over the impact of Greece's bailout deal with Europe
Wall paintings have sprung up all over the city reflecting the general frustration at rising unemployment and falling living standards