Greece says it has broadly agreed the substance of a bailout deal with its creditors, according to Greece’s finance minister Euclid Tsakalotos.
“Two or three small issues,” are pending with lenders, Reuters quoted Mr Tsakalotos as saying.
An agreement is needed keep the country in the eurozone and avert bankruptcy.
The Greek government is hoping to push the new €86bn (£60bn) three-year agreement through parliament later this week.
The country needs a deal by 20 August, when the country has a debt repayment of about €3bn to make to the European Central Bank.
Greece will not be able to make that payment without funds emerging from the country’s third bailout in just over five years.
Emerging from all-night talks at a central Athens hotel with negotiators representing Greece’s creditors, Mr Tsakalotos said: “I think we are very close.”
“Two or three very small details remain,” he added.
Earlier, Reuters quoted a Greek official as saying an agreement had been reached.
Greece has agreed the function of a new independent privatisation fund, and how non-performing bank loans will be administered, according to the official.
Both issues had been key sticking points in negotiations.
“Finally, we have white smoke,” the official was quoted as saying.
Analysis: Robert Peston, BBC economics editor
The really hard negotiations start soon – on how to reduce Greece’s massive debts, set to peak at close to 200% of GDP or national income in the next two years (according to the IMF) to an affordable level.
Without debt write-offs, prosperity will never return to Greece, and its future in the euro will never be assured.
With debt write-offs, populist parties throughout the eurozone will be able to claim to voters that they have nothing to fear and everything to gain from throwing out the mainstream establishment parties and re-asserting national sovereign rights to economic self-determination.
Or to put it another way, euro politics and euro economics of Greek debt forgiveness point in diametrically opposed directions.
Which is why no-one should see today’s important bailout agreement for Greece as a permanent happy ending.
Vicky Pryce, chief economic adviser at the Centre for Economics and Business Research in London, told the BBC that the deal would come under close scrutiny in the Greek parliament.
“There is some dissent. There is no doubt that the very left wing part of the Syriza party – which is the ruling coalition party – is not at all happy with what’s been going on,” she said.
She added that so far the Syriza prime minister Alexis Tsipras has managed to get support for the third bailout by relying on his opposition parties, which are “determined to see that the whole thing is actually sorted out, so that’s not a very sustainable situation for the future”.
Though the radical left-led government was elected on a staunchly anti-austerity platform in January, it was forced into a policy U-turn after bailout talks came close to collapse last month.
Greece has relied on international bailouts totalling €240bn since it lost market confidence and was unable to borrow from anyone else in 2010.
To secure funds from the bailouts, successive governments have had to implement a series of spending cuts, tax hikes and reforms.
The austerity reduced budget overspending, but the measures compounded a deep recession and fuelled record high unemployment.
Figures next week are expected to show that Greece’s recession deepened in the second quarter as concerns over the country’s euro future dented confidence.