Brazil's economy posted higher-than-expected growth of 1.2 percent in the second quarter, official data showed Thursday, giving President Jair Bolsonaro a boost ahead of elections next month.

The result beat analyst expectations for 0.9 percent growth in Latin America's largest economy. It was the fourth straight quarter of expansion for the Brazilian economy as it rebounds from the effects of the coronavirus pandemic.

This latest spurt of growth was fueled by rises in manufacturing (up 2.2 percent) and the service sector (1.3 percent), the state statistics agency IBGE said.

Compared to the second quarter of last year, the expansion was 3.2 percent.

Accumulated growth in the first half of the year was 2.5 percent compared to projections of close to stagnation.

The figures are good news for Bolsonaro, who is fighting to narrow a 15-point deficit in public opinion polls as he takes on leftist ex-president Luiz Inacio Lula da Silva.

On Wednesday, the government reported a decline in unemployment to fewer than 10 million people for the first time since 2016.

Claudia Moreno, an economist at digital bank C6, pointed to a "recovery in investments (4.8 percent) and family consumption (2.6 percent) in the second quarter compared to the previous one" despite high inflation as significant drivers.

The improved performance of the economy has led analysts to revise their 2022 growth predictions from under 0.3 percent in January to 2.1 percent, according to the latest central bank survey.

Even so, economists expect growth to slow in the third quarter due to the delayed effect of the central bank's hike in interest rates in a bid to slow down inflation.

Interest rates have risen from a historic low of two percent in March 2021 to 13.75 percent last month.

Inflation, which is one of the main issues worrying voters, was over 10 percent in the 12 months to July, with Bolsonaro's government cutting utility rates and fuel prices in a bid to put the brakes on.

Moreno believes another reason for slowing growth over the second half of the year is that the service sector has now recovered from the pandemic.

She says the economy will also be affected by "a drop in the price of raw materials and the global slowdown."

Analysts believe there will be an injection of cash into the economy thanks to a 50 percent increase in social assistance to 20 million vulnerable families from 400 to 600 reais ($80 to $120).

Brazil ended 2021 with 4.6 percent growth compared to the previous year, when the economy shrank by 3.9 percent due to the pandemic.