Brazil's 12-month budget deficit reached 7.80% of gross domestic product in December, narrower than the 8.99% shortfall recorded a year earlier, said the Central Bank of Brazil.

The primary budget result, which excludes interest payments, was a deficit of 1.69% of GDP in 2017, compared with a deficit equal to 2.49% of GDP the year before, the bank said..

The annual result is better than official forecasts of a deficit equal to 2.1% of GDP.

Since records began in 2002, the country always logged primary surpluses, meaning there were funds left to pay down debt. It turned into red ink in 2014, as a recession sapped tax income while an insolvent pension system kept public spending high.

As a result, Brazil's gross debt ended 2017 at a high 74% of GDP, only slightly below the 74.4% recorded in November, which was the highest level on record.

Spending cuts and higher tax income thanks to a budding economic recovery helped last year, the Finance Ministry said earlier this week. The economy is expected to have grown around 1% in 2017 after two consecutive years of contraction.

But government officials say a pension overhaul is needed to keep the budget under control.

Brazil recorded in 2017 a social-security deficit of $58 billion, up 21.8% from a year earlier. Brazilians are allowed to retire in their mid-50s and their contributions aren't enough to cover pension payments. Plugging the shortfall could involve making retirement harder for millions, something lawmakers are reluctant to do ahead of the October general elections.