Eureka! Greece has a deal.
Greece and its creditors have completed negotiations on the terms of a third bailout package. The deal, worth up to 86 billion euro ($95 billion), still needs to receive a stamp of approval by the eurozone leaders, but is expected to be finalized within days.
The European Commission president Jean-Claude Juncker is set to talk with German chancellor Angela Merkel and French president François Hollande on Tuesday. Germany and France are the biggest contributors to the Greek bailout and their agreement with the deal is crucial.
"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 Breidthardt said.
Greece will have to pass more economic reforms in order to receive the money. It has already agreed to overhaul its pension system, increase taxes, adopt Europe-wide banking rules, and transfer up to 50 billion euros ($55 billion) worth of assets to an independent fund.
The agreement sets limits to Greece's budget deficit for the next three years.
Other reforms include deeper labor market reforms, including changes to collective bargaining rules, liberalization of the country's energy market, and more spending cuts.
Related: Europe's bailed out economies are booming. Except Greece, of course
The Greek finance ministry said in a statement that Greek banks will be infused with fresh funding later this year as part of the agreement.
Greece must make a 3.2 billion euro payment to the European Central Bank on August 20, if it wants to stay in the euro. Europe has already provided Greece with 7.16 billion euros in a bridge loan.
The rescue -- Greece's third since 2010 - should secure its place in the euro, for now. The country's potential exit from the currency union would have shaken Europe to its core. But it's unlikely the package will solve Greece's deep economic problems. The European Commission expects the economy to shrink by 4% this year, and the IMF has warned it is becoming unsustainable. The latest government reports show unemployment was 25.6% in June.
The Greek parliament is expected to vote on the new package on Thursday. After that it will have to be passed by national parliaments in several other eurozone countries, including Germany. That's because the loans given to Greece will be backed by the other countries' taxpayers.
Related: The Greek crisis...in 2 minutes
CNN's Zahra Ullah and Chris Liakos contributed to this report.