Image copyright Reuters Image caption The agreement came after all-night talks at a central Athens hotel

Greece has agreed a bailout deal "in principle" with its creditors, the European Commission has said.

The Commission said a technical agreement had been reached with Greece, which now requires political approval.

Greek Prime Minister Alexis Tsipras has asked parliament to convene so that MPs can debate the details on Wednesday before a vote on Thursday.

A deal on a new €85bn (£60bn) three-year agreement is needed to keep Greece in the eurozone and avert bankruptcy.

Earlier, Greece's Finance Minister Euclid Tsakalotos had said "two or three small issues," were yet to be resolved with lenders, following overnight talks in Athens.

The country needs a deal by 20 August, when it has a debt repayment of about €3bn to make to the European Central Bank.

Technical deal

A European Commission spokeswoman said a technical deal had been reached last night between parties including Greece, the International Monetary Fund, the European Central Bank, and the European Stability Mechanism.

She said a series of phone calls between political leaders would now take place.

A Greek official said earlier that Greece agreed the function of a new independent privatisation fund, and how non-performing bank loans will be administered.

"Finally, we have white smoke," the official said.

Deregulation of the natural gas market, another sticking point, was also agreed.

But Finnish Finance Minister Alexander Stubb sounded a cautious note, saying more work needed to be done with the details to finalise the agreement.

The Eurogroup of eurozone finance ministers is to meet on Friday to discuss approval of the deal, Spanish Prime Minister Mariano Rajoy said.

His centre-right People's Party, which has a majority in the Spanish parliament, will be asking other parties to vote in favour of the agreement, he added.

Greek bailout deal - some key points

A Greek official said:

The deal secures funding of around €85bn to service debt as well as to settle public payment delays and arrears over the next three years

There will be a deal on primary surplus targets: 0.25% GDP deficit for 2015, 0.5% surplus in 2016, 1.75% in 2017 and 3.5% in 2018

The agreement reduces fiscal surpluses for the next 3 years by 11% of GDP - "As a result there will be no new austerity measures in the forthcoming period," the official said

Recapitalisation of the banking sector will be completed before the end of 2015, with €10bn being immediately available

The government did not consent to the sale of non-performing loans to private companies

The agreement provides for a €35bn development package, known as the "Juncker package"

What was the deal?

July - Bailout deal at a glance

According to Greek reports, which EU officials did not confirm, the deal phases out early retirement and brings in a gradual increase of the pension age to 67 by 2022.

There will be a review of the Greek social welfare system with the aim of cutting expenditure, and the gas market will be deregulated by 2018.

Privatisation plans for ports at Piraeus and Thessaloniki will go ahead, there will be an opening up of professions, and a tightening of the definition of who is a farmer.

In addition, the reports said there would be an increase in the tax on shipping.

Meanwhile, Mr Tsipras said he wanted a draft law on the bailout submitted to parliament later on Tuesday, so that MPs can debate the issues on Wednesday and vote on Thursday.

He said in a letter to MPs: "The crucial nature of the situation requires the immediate convening of parliament to proceed with the deal's approval and allow the disbursement of the first instalment [of money]."

Image copyright Getty Images

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.

Read Robert's blog in full

Media playback is unsupported on your device Media caption Newsnight's Duncan Weldon breaks down the main points of the deal

How did Greece get here?