(Adds comments by Treasury secretary)
BRASILIA, June 29 (Reuters) - Brazil's government is still on track to hit its annual budget target despite a sharp and unexpected widening of the deficit last month, the country's Treasury chief said on Thursday.
The government, which is trying to push an unpopular austerity agenda through Congress, posted a primary budget deficit of 29.371 billion reais ($8.88 billion) in May, compared to 15.478 billion reais in the year-earlier period.
Economists in a Reuters poll had expected a deficit of 20 billion reais. The May deficit was the biggest ever recorded for that month.
The deficit in the 12 months through May reached 167.6 billion reais, equivalent to 2.59 percent of gross domestic product. The official target for 2017 is for a deficit of 139 billion reais. Economists are forecasting it will be 142 billion reais, according to a Finance Ministry survey.
Treasury Secretary Ana Paula Vescovi told journalists the deficit widened last month mainly due to a decision to service judicial debts ahead of schedule, a move she said would help save between 600 million and 700 million reais this year.
She added that measures under discussion, including a farm tax renegotiation, could boost extraordinary revenues by about 15 billion reais this year.
President Michel Temer's government, stung by the loss of Brazil's investment-grade rating, has signaled it is ready to raise taxes later this year if needed to hit the budget target as weaker-than-expected economic growth weighs on tax revenues.
Brazil is emerging from its worst recession on record.
($1 = 3.3058 Brazilian reais) (Reporting by Silvio Cascione; Editing by Andrew Hay and Paul Simao)