BUDAPEST (Reuters) - After keeping Hungary in junk for years, rating agency Standard and Poor’s lifted the country’s debt rating back into investment grade on Friday in a surprise move, rewarding Prime Minister Viktor Orban for fixing state finances and boosting the economy.

Hungarian Prime Minister Viktor Orban delivers a speech during a business conference in Budapest, Hungary, March 10, 2016. REUTERS/Laszlo Balogh

The agency raised Hungary to BBB-/A-3 from BB+/B, citing improving fiscal, external, and growth expectations, while maintaining its stable outlook.

The move, which markets had not expected so soon, followed an upgrade by Fitch in May, and immediately boosted the forint. It is expected to drive Hungarian government bond yields lower as some investors will shift money into Hungarian assets.

Returning Hungary’s debt to investment grade could boost Orban’s standing at home and abroad at a time when he has upset international partners with his tough stance on migrants and refugees. Orban, who showed the IMF the door after he rose to power in 2010, has pursued a go-it-alone economic policy since then.

S&P said Hungary’s economy could grow at an average rate of 2.5 percent in coming years, helped by rising consumption, while its public debt was expected to decline to about 70 percent of gross domestic product in 2019 from 75 percent in 2015.

"Hungary's external financial profile, which has improved considerably since 2009 will remain robust," the ratings agency said. (bit.ly/2cuikSd)

“Rising employment and real disposable incomes are likely to continue fueling private consumption growth.”

In 2016 Hungary’s budget deficit is expected to narrow to 1.8 percent of GDP, well below the EU’s 3 percent ceiling.

Economy Minister Mihaly Varga said the upgrade was “long overdue” and it could make debt financing cheaper while boosting the forint.

“The good performance of the Hungarian economy has borne fruit. The market has taken this step long ago, now we have returned to the category where we would have belonged for some time,” Varga told a news conference.

He said the third big rating agency, Moody’s, could lift Hungary’s rating to investment grade in November when its next review is due, and that Hungary might tap international markets within a few months with a foreign currency bond, but not in the short term.

Hungary’s debt was downgraded to junk by major rating agencies after Orban took power in 2010 and embarked on unorthodox policies to steady the budget, which included punitive taxes on the financial sector.

But last year Orban made a truce with banks he had squeezed for years and his right-wing government has kept the budget deficit firmly under control since 2012.

FUNDS TO SHIFT

Dealers said Hungarian assets would quickly benefit from the upgrade, with the forint gaining further versus the euro and yields falling, even though markets have mostly priced in a positive change in Hungary’s credit rating for this year.

“Now, with two agencies at investment grade, Hungary is de facto investment grade, and a number of real money asset managers would likely increase their portfolio exposure based on risk criteria alone,” Commerzbank said in a note.

Attila Behan, a chief dealer at KH Bank in Budapest, said Hungarian long-term bonds could be popular with investors now.

“Now it is not only the short end which will be bought but also the medium and long end of the curve, and its steepness can decline markedly,” he said, adding that the forint could soon test levels even firmer than 300 to the euro.

Hungary’s central bank, which holds a rate meeting on Tuesday where it is expected to keep its main base rate unchanged at a record low of 0.9 percent, was not immediately available for comment.