Global debt hit its highest levels ever and governments should take actions to reduce their indebtedness while the going is still good, the International Monetary Fund said. Total debt levels globally came in at a record $164 trillion in 2016, amounting to 225 percent of the world economy's gross domestic product, according to the IMF's April Fiscal Monitor. That level of debt was 12 percentage points steeper than the last historic high seen in 2009 immediately after the global financial crisis. Those findings, taken together with the business cycle upswing, meant that governments should build buffers and cut public debt levels to face "challenges that will unavoidably come in the future," Vitor Gaspar, director of the fiscal affairs department at the IMF, told CNBC's Joumanna Bercetche. "Because times are good. It's exactly in good times that you can build buffers and resilience," Gaspar said.

Advanced economies look worse

Meanwhile, debt in advanced economies far exceeded debt levels in emerging markets, the IMF said. According to its latest report, average debt for advanced economies stood at 105 percent of GDP. For middle-income economies, debt was around 50 percent of GDP on average, while debt for low-income countries, which have been experiencing rising average debt-to-GDP ratios, came in above 40 percent last year, the IMF stated.

Gaspar said the IMF has forecast that public debt-to-GDP ratios for advanced economies, with the exception of the U.S., are expected to decline in the period ending in 2023. "The United States is the only country where the public debt-to-GDP ratio is forecast to go up, from 108 percent of GDP in 2017 to 117 percent in 2023," Gaspar added, attributing the rise to the spending plan passed by Congress and recent tax cuts.

Bumpy road ahead?