Eurozone finance ministers have agreed on a new bailout deal for Greece after Athens backed the plan.

European Commission President Jean-Claude Juncker said the deal sent a message "loud and clear" - Greece will stay in the eurozone.

The agreement demands tax rises and more tough spending cuts in return for Greece's third bailout in five years.

The deal means new loans of up to €86bn ($95bn; £61bn) will be made available over the next three years.

The first tranche will be of €26bn - €10bn to recapitalise Greek banks and €16bn in several instalments, the first of which - €13bn - will be made by 20 August, when Greece must repay about €3.2bn to the European Central Bank (ECB).

The deal comes at a heavy political price for Greek Prime Minister Alexis Tsipras, who has faced a rebellion in his left-wing Syriza party.

More than 40 Syriza MPs voted against him when parliament decided on the bailout agreement on Friday, after all-night talks. Reports in Greece suggest he will seek a vote of confidence in parliament next week, bringing the prospect of snap elections closer.

Debt relief issue

Announcing the "comprehensive and ambitious reform package", Eurogroup chairman Jeroen Dijsselbloem said: "All the intense work of the past week has paid off.

"If implemented with determination, the deal will allow the Greek economy to return to growth."

He added: "Of course there were differences, but we have managed to solve the last issues."

Mr Juncker said: "The past six months have been difficult. They have tested the patience of policy-makers and they have tested the patience of our citizens even more.

Media playback is unsupported on your device

Media captionEurogroup chairman Jeroen Dijsselbloem says the deal is "in line with the key objectives set by the euro summit on 12 July"

"Together, we have looked into the abyss. But today, I am glad to say that all sides have respected their commitments."

He added: "The message of today's Eurogroup is loud and clear: on this basis, Greece is and will irreversibly remain a member of the euro area."

The deal rules out any "bail-in" of depositors' savings in Greek banks.

Greek Finance Minister Euclid Tsakalotos said the deal "takes Greece forward in the sense that the financial system should be much more stable from now onwards. There is a promise of recapitalisation of the banks, without any of the depositors having to bail in or anything to worry about."

There will have to be a series of votes in national parliaments across Europe to back the deal.