ATHENS, Aug 11 (Reuters) - Greece and its international lenders reached a multi-billion euro bailout agreement on Tuesday after talking through the night, officials said, potentially saving the country from financial ruin.
The agreement, reached after a 23-hour session of talks, must still be adopted by Greece's parliament and euro zone countries. The single currency bloc's finance ministers are due to meet on Friday, giving time to finalize the deal before a major debt repayment next week.
The negotiations appeared to have resolved all the main outstanding issues, after Greece's leftist government effectively capitulated last month to creditors' demands for deep austerity measures in order to receive loans.
"Finally, we have white smoke," a Greek Finance Ministry official said after exhausted Greek officials emerged in a central Athens hotel to announce the two sides had agreed on terms. "An agreement has been reached."
Finance Minister Euclid Tsakalotos confirmed only "two or three small issues" were pending. Greek shares rose, with the banking index surging 6 percent, while two-year bond yields fell more than 4 percentage points.
"The institutions and the Greek authorities achieved an agreement in principle on a technical basis. Now as a next step, a political assessment will be made," European commission spokeswoman Annika Breidhardt said in Brussels.
Still, officials in skeptical northern European countries remained cautious, pending final approval of the deal.
"There remains work to be done with details," said Finland's Finance Minister Alexander Stubb. "We must take one step at a time. Agreement is a big word."
Commission President Jean-Claude Juncker was due to hold talks later on Tuesday with German Chancellor Angela Merkel and French President Francois Hollande.
Approving the agreement would close a painful chapter of aid talks for Greece, which fought against austerity terms demanded by creditors for much of the year before relenting under the threat of being bounced out of the euro zone.
After a deal in principle last month, the latest round of 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 recapitalised by the end of the year.
An EU diplomat said the agreement was worth between 82 billion and 85 billion euros.
Greek officials have said they expect the accord to be ratified by parliament on Wednesday or Thursday and then vetted by euro zone finance ministers on Friday. 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.
Facing a revolt from the far-left of his leftist Syriza party, Prime Minister Alexis Tsipras is expected to once again rely on opposition support to push the package through parliament. Once the deal is ratified, Tsipras is expected to tighten his grip over the party by facing down rebels at a party congress next month before considering early elections.
Even then, doubts remain about whether a leftist government elected on a pledge to reverse austerity can implement the punishing terms of an agreement that critics say compromises the government's basic principles.
Popular misgivings about funneling yet more money to Athens run deep in Germany, the euro zone country that has contributed most to Greece's two bailouts since 2010.
Berlin had cautioned that the talks must focus on "quality before speed," raising questions about whether it would seek to slow down the process by insisting on conditions attached to aid.
"We're talking about a program for three years, it needs to be negotiated thoroughly," Deputy Finance Minister Jens Spahn told Germany's ARD television shortly before the deal was announced. "It must be convincing that it's not just about Aug. 20."
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 Athens, in contrast to acrimonious negotiations during most of the year.
In talks that dragged through Monday night, the sides reached agreement 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.
Athens wanted to set up a "bad bank" to take on the problem loans, while creditors want them bundled and sold to distressed debt funds. It was not immediately clear how that was resolved.
Officials had also argued over how to set up a sovereign wealth fund in Greece designed to raise 50 billion euros from privatizations, three-quarters of which would be used to recapitalise banks and to reduce the debt.
A few technical details on measures -- such as a law governing individual bankruptcies -- that Greece must pass before getting aid were still being discussed between technical experts from both sides, another Greek official said.
The overnight talks also found common ground 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.
Adapted from an earlier baseline scenario, the targets foresee a primary budget deficit of 0.25 percent of gross domestic product in 2015, and surpluses of 0.5 percent in 2016, 1.75 percent in 2017, and 3.5 percent in 2018, the official said. ($1 = 0.9074 euros) ($1 = 0.9063 euros)
Earlier on HuffPost: