Brazil fell into a recession in the first half of the year as investment fell sharply and the country's hosting of the World Cup suffocated economic activity.

The outcome is seen as a major blow to President Dilma Rousseff's already fading hopes for re-election in October.

Latin America's largest economy has suffered stagnant growth for more than three years under the economic policies of the left-leaning Rousseff, which have dented consumer and business confidence and caused heavy losses for financial investors.

The economy took an even bigger downturn in the second quarter, with gross domestic product contracting 0.6% from the first quarter, government statistics agency said. 

It also revised lower its estimate for first-quarter activity to a 0.2% contraction, meaning the economy entered a recession.

The data that confirmed the recession, Brazil's first since the global financial crisis of 2008-09, gives a powerful weapon to Rousseff's opponents in the election at precisely the moment that her candidacy is at its most vulnerable.

Brazil's economy grew an average 4% under Rousseff's predecessor, Luiz Incio Lula da Silva, from 2003 to 2010.

Growth under Rousseff's watch is set to average less than 2%.

Global demand for Brazil's major commodities such as iron ore, sugar and corn also slackened, compared to the glory days of the last decade, when the economy often grew more than 5% a year, lifting some 35 million people out of poverty.