Greece and its international lenders have reached an €85 billion bailout agreement 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 eurozone countries.
Eurozone finance ministers are expected to give their approval on Friday in time for Greece to make a crucial €3.2 billion debt repayment that falls due next week.
Greek shares rallied, with the banking index climbing 3%, 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 the government 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.
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 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 programme 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.
Eurozone finance ministry officials taking part in the so-called euro working group agreed to recommend approval of the bailout when eurozone finance ministers meet on Friday, a source at the Italian Treasury said.