Two of Europe’s most dysfunctional economies of late got votes of confidence this week when ratings firms raised their views on Spain and Greece, two countries directly linked to the eurozone’s long-running debt crisis.

Standard & Poor’s raised Spain’s long-term rating one notch to BBB, following the lead of ratings firms Fitch and Moody’s Investors Service, which had previously lifted Spain’s rating. Meanwhile, Fitch lifted Greece’s rating one level to B.

While both upgrades are above junk bond status, the ratings for both countries remain well below investment grade. And each of the recent upgrades has been issued with caution, mostly related to ongoing political instability that threatens the positive momentum brought about by economic reform.

The upgrades arrived as renewed investor interest in debt issued by Spain and Greece has pushed borrowing costs lower for the two embattled southern European nations, marking an important turning point for both economies.

Fitch, for example, said Greece’s economy is “bottoming out.” Which means it's got no place to go but up.

Both countries agreed to introduce significant economic reforms as conditions for receiving large bailouts from the so-called European troika – the European Commission, the International Monetary Fund and the European Central Bank. Those reforms seem to be working.

S&P said its upgrade of Spain “reflects our view of improving economic growth and competitiveness as a result of Spain’s structural reform efforts since 2010, including the 2012 labor reforms.”

Fitch said of Greece in a statement announcing its upgrade, “A better fiscal track record is being established. Greece’s deficit reduction over the past four years of its two (reform) programmes has been remarkable.”

Spain and Greece were two of the so-called PIGS, four European countries (Portugal and Ireland were the others) so burdened by debt five years ago that many analysts believed a default by any of them could bring about the collapse of the single-currency eurozone.

Huge budget deficits caused by stagnant economies and years of excessive spending on social programs and government payrolls and pensions buried Spain and Greece in debt, leaving the southern European nations unable to pay off their loans and unable to borrow more money. With both countries teetering on the edge of financial collapse, a debt crisis was triggered across Europe as other countries and major banking institutions that held Spanish and Greek debt pondered the fallout from a default by either or both countries.

Instead, bailouts accompanied by mandated reforms, which included dramatic cutbacks in government spending and raising taxes, staved off defaults.

Now the reforms are having the desired impact and debt issued by the countries, virtually untouchable just a few years ago, is growing attractive again. On Thursday, for instance, Spain auctioned five and ten-year bonds at their lowest yield levels in about a decade.

But risks still abound. Political volatility in both countries, fueled by high unemployment and dramatic reductions in publicly funded social programs, could upend reforms.

S&P’s statement on its Spain upgrade said it expects that “the upcoming 2015 regional and general elections, ongoing deep socioeconomic challenges and significantly reduced capital market pressure could lead to fiscal and structural policy slippages.”

Meanwhile, Jane Foley, senior currency strategist at Rabobank in London, told FOX Business Network on Friday, “Politics in Greece is potentially the threat to stability over the next year or two.”

If elections were held today, Foley suggested, the current Greek government would probably be thrown out in favor of a far-right leaning party that has been vowing to replace benefits taken away by the economic reforms implemented in recent years.

Follow Dunstan Prial on Twitter @DunstanPrial