In its rationale for the rating action, S&P pointed to falling inflation, a marked reduction in the current account deficit, albeit supported by lower global energy prices, and a recovery of the forint's exchange rate.

S&P projects a 0.5% contraction of GDP in 2023 but sees the economy expanding by 2.6% in 2024.

Fiscal consolidation will "remain more challenging", S&P said, projecting general government deficits of 5.2% of GDP in 2023 and 4.5% in 2024. State debt levels are expected to "broadly stabilize" at around 72% of GDP until 2026, the rating agency added.

S&P's projections are based on the assumption that Hungary and the EU will ultimately reach an agreement and some of the country's EU funding will be released in the first half of 2024.

The agency could lower the sovereign rating if Hungary's EU funding is "significantly" cut or the country's energy supply is constrained, given its still-high import dependence on Russia. The rating could be raised if Hungary's twin deficits are reduced more quickly than expected.