ATHENS, Greece - The Standard & Poor's ratings agency on Tuesday upgraded Greece's credit grade by six notches, yanking the debt-heavy country out of default but keeping its devalued bonds in junk status.

The agency said the upgrade to B-minus - the highest grade it has given Greece since June 2011 - reflected its view that the 16 other European Union countries using the euro are determined to keep Greece inside the currency union.

It also gave Greece a stable outlook, meaning it is less likely to change its rating again soon.

"The stable outlook balances our view of eurozone member states' determination to support Greece's eurozone membership and the Greek government's commitment to a fiscal and structural adjustment against the economic and political challenges of doing so," the agency said in a statement.

An upgrade was expected since S&P had this month temporarily lowered Greece's rating to the bottom of its scale - "selective default" - because the country was buying back its own debt. The agency said that because the buyback did not force any investors to sell their bonds back - which would have constituted a default - it was raising the rating.

The bond buyback was successfully completed last week, and will reduce the country's debt by some 20 billion euros ($26.4 billion).

The size of the upgrade suggests EU leaders are seeing some results in their effort to bring Greece's debt load under control.

However, the credit rating is increasingly losing any market relevance, because there are very few private investors still holding Greek bonds. After completing the buyback and receiving multiple bailout packages over three years, Greece now owes the bulk of its debt to fellow eurozone states, the International Monetary Fund, and the European Central Bank.

Greece's bonds have been rated as non-investment grade - or junk - since 2010, when the country's finances imploded after Athens admitted it had severely underestimated its budget deficit.