ATHENS (Reuters) - Greece and its international lenders reached an 85 billion euro bailout agreement on Tuesday after nailing down the terms of new loans needed to save the country from financial ruin.
The deal, which came after 23 hours of talks that continued through the night, must still be adopted by Greece's parliament and by euro zone countries.
The currency bloc's finance ministers are expected to give their approval on Friday in time for Greece to make a crucial 3.2 billion euro debt repayment that falls due next week.
Greek shares rallied, with the banking index climbing 3 percent, while the government's two-year borrowing costs fell to a five-month low.
The agreement gives Greece some respite after a turbulent year marked by acrimonious talks with lenders, the imposition of capital controls and a three-week shutdown of its banks before Athens capitulated last month to creditors' demands for deep austerity measures in order to receive new loans.
But the deal has caused a rebellion within Prime Minister Alexis Tsipras's Syriza party, forcing him to rely on opposition support in parliament and raising talk of early elections in the autumn.
Tsipras wants parliament to approve the deal by Thursday, before the euro zone finance ministers reconvene. This would pave the way for aid disbursements by Aug. 20, when a 3.2 billion euro debt payment is due to the European Central Bank.
But he could face an obstacle from Parliament Speaker Zoe Constantopoulou, one of the creditors' fiercest critics, who may delay a parliamentary committee expected on Wednesday till Thursday, potentially pushing back the vote, Mega TV reported.
Doubts remain about whether a leftist government elected on a pledge to reverse austerity can implement the punishing terms of a deal critics say compromises the left's basic principles.
"It is a very tough deal. The left had to either escape or take huge responsibilities and prove it can help society," Health Minister Panagiotis Kouroublis told local radio, calling for snap elections to lock in popular support.
"After this deal the prime minister should call for elections, so that the Greek people can vote on whether they approve the program or want something else," he said.
The European Commission confirmed a deal had been struck at a technical level and that political assessment would follow.
Euro zone finance ministry officials taking part in the so-called 'euro working group' agreed to recommend approval of the bailout when euro zone finance ministers meet on Friday, a source at the Italian Treasury said.
Still, officials in skeptical northern European countries remained cautious, pending final approval of the deal.
"There remains work to be done with details," said Finnish Finance Minister Alexander Stubb. "We must take one step at a time. Agreement is a big word."
European Commission President Jean-Claude Juncker was due to hold talks later on Tuesday with German Chancellor Angela Merkel and French President Francois Hollande.
Misgivings about giving yet more money to Athens run deep in Germany, the euro zone country that has contributed most to Greece's two bailouts since 2010.
German Deputy Finance Minister Jens Spahn told Reuters the deal should be able to stand for the next few years rather just a few months.
Approval of the agreement would close a painful chapter for Greece, which resisted the austerity terms demanded by creditors for much of the year before relenting under threat of being bounced out of the euro zone.
After a deal in principle last month, talks began in Athens three weeks ago to craft an agreement covering details of reform measures, the timeline for their implementation and the amount of aid needed.
A Greek Finance Ministry official said the pact would be worth up to 85 billion euros ($94 billion) in fresh loans over three years. Greek banks would get 10 billion euros immediately and would be recapitalized by the end of the year.
An EU diplomat said the agreement was worth between 82 billion and 85 billion euros.
The latest round of talks with inspectors from four creditor institutions -- the European Commission, European Central Bank, the European bailout fund and the International Monetary Fund -- progressed smoothly, in contrast to the bad-tempered encounters of earlier in the year.
In talks that dragged through Monday night, the sides agreed on the three main sticking points - dealing with non-performing loans held by banks, setting up an asset sales fund, and deregulation of the natural gas market.
The talks also agreed on final fiscal targets that should govern the bailout effort, aiming for a primary budget surplus -- which excludes interest payments -- from 2016, a government official said.
($1 = 0.9074 euros)
Additional reporting by Karolina Tagaris and Lefteris Papadimas in Athens, Giselda Vagnoni in Rome; Writing by Michele Kambas and Deepa Babington; Editing by Giles Elgood and Gareth Jones