Greek Finance Minister Yanis Varoufakis (Reuters/Yves Herman)

Greece and European finance officials on Friday reached an 11th-hour deal to negotiate for four more months over a long-term plan to solve the country's financial woes and help ease an economic crisis that has consumed Europe for much of this decade. The agreement, in doubt for much of this week, avoids a potentially catastrophic exit by Greece from the euro zone.

This latest deal continues, with a few changes, the terms of the November 2012 financial rescue that had given Greece money in exchange for tough reforms to the country's economy, including sharp tax hikes and budget cuts. Those harsh measures helped push Greek unemployment over 25 percent, and they ultimately brought the new left-wing party Syriza to power last month with its promises to end the onerous terms of the old agreement.

European finance officials agreed in principle to extend Greece's financial rescue by four months, averting a potential crunch that could have forced Greece to drop from the euro zone. (Reuters)

Syriza, led by the 40-year-old Prime Minister Alexis Tsipras, had set Greece on a collision course with Germany, Europe's economic heavyweight, which had insisted that Greece abide by the tough austerity measures in exchange for financial support. Many analysts expected that Syriza would refuse, prompting Greece's exit from the Euro zone, the monetary union that was supposed to usher in an era of economic stability in Europe but instead is being blamed for causing now-depression conditions across the continent. 

The news was welcomed by markets. The Dow Jones Industrial Average closed the day up 155 points at 18,140, and the Standard & Poor's 500 finished at 2,110, up 13 points. Both the Dow and S&P 500 were at all-time highs.

On the surface, it looks like Germany got everything it wanted out of this agreement, because it extends the current bailout with a few tweaks. But those tweaks aren't on Germany's terms. Greece will get to pick what economic reforms it's going to make, like stricter tax collection or stingier pension benefits — subject, of course, to Europe's approval — but, more importantly, it won't have to do any more austerity this year.

So for all the Greek drama, or if you prefer it in the German, sturm und drang, this latest wrangling ended with a pretty good compromise. Europe doesn't feel like it's throwing bad money after worse, and Greece doesn't have to do any more "fiscal waterboarding," as its finance minister Yanis Varoufakis has put it. And if both sides can build up some more trust, as they emphasized Friday, then they should be able to reach a bigger deal a few months from now: more reforms for even less austerity. This is about the best Greece could have hoped for.

But let's not get ahead of ourselves. Greece still has to come up with a list of reforms for Europe to sign off on by this coming Monday. If Europe balks, then there's no deal — and Greece's banks might collapse. That's because they depend on the European Central Bank to stay afloat — it provides cheap loans to Greek banks — but the ECB has said it might pull the plug if there's not a framework in place. To show it's not bluffing, or at least make it look like that, the ECB has already limited their access to the lowest-cost funds. What would happen if it cut them off entirely? Well, Greece would have to put controls in place to prevent people from taking their money out of the banks and then out of the country. And then it'd have a choice: Greece could either leave the euro and print money to recapitalize its banks, or it could kind of, sort of stay in the euro as an even more unequal member that did everything it was told.

What Greece got out of this deal was a measure of fiscal sanity. Now it sounds a little crazy, but the terms of negotiations over Greece's future — and how much austerity is required — has become largely detached from the country's concerns about paying its debts. The interest rates on what it owes are already very low and the loans don't have to be fully paid back for a very long time. So even though its debt is 180 percent of gross domestic product, its debt payments are only 2.6 percent of GDP (which is essentially where France is). Not only that, but the worst kept secret in Europe is that Greece is never going to pay back everything it owes. So there's no reason Europe wouldn't lower those interest rates and lengthen those maturities even more until, someday, they're zero and forever. In other words, until that debt was no longer debt.

But between then and now, Greece is supposed to increase its primary budget surplus from 1.5 percent of GDP last year to 3 percent this year and 4.5 percent the next. A country's primary balance is just its budget minus its debt payments, so it's the best measure of how sustainable its current spending is. The problem, as Paul Krugman explains, is this would hurt Greece's economy more than twice as much as it would save. That's because when interest rates are zero, as they are now, less government spending means less economic activity. And less economic activity means less tax revenue. When you add it all up, cutting spending by one euro would only save about half a euro. That's why another 3 percent of GDP of surpluses would cost Greece about 7.5 percent of GDP itself.

The good news, though, is that Greece got Europe to concede that it "will, for the 2015 primary surplus target, take the economic circumstances of 2015 into account." In other words, Greece won't have to do the austerity it was supposed to do this year. Who knows, it might not even have to run as big a primary surplus as it did last year when you consider how much all this political uncertainty has hurt its economy and tax receipts so far. And no, it doesn't matter that there aren't any promises about its fiscal targets after this year. There should be another deal in a few months that hammers that out.

This isn't the end of the Greek crisis, but it is the end of the Greek crisis getting worse. Both sides have given in a little rather than see it leave the euro. Greece has agreed to let the ECB, European Commission, and International Monetary Fund continue to monitor its reforms when it had said it wouldn't anymore. The only concession it got was that this group will be called "the institutions" instead of "the troika." (Seriously).

But Europe has also given in by relaxing Greece's austerity. It's a small step by both sides, but if they follow through on their promises, it should start to build up enough trust for them to take bigger ones at their next deal. If it works out, Greece will get the reforms it really does need, but also have enough money it needs to spend on what at this point is humanitarian relief: food stamps, healthcare, and electricity for all the Greek people who can no longer afford them.

It turns out the way through the Gordian knot was a simple compromise.