Moody's decision comes two weeks after competing ratings firm Standard & Poor's warned Brazil could lose its investment grade in the coming year if fallout from a number of corruption investigations further weigh on economic growth.

In contrast, Moody's said it believes Latin America's largest economy has the ability to achieve a turn-around in growth and fiscal performance in the second half of Rousseff's four-year term, which started Jan 1.

"Even though Moody's expects the economic environment to remain poor and political dynamics to remain relatively unstable in 2015 and 2016, the rating agency does not currently expect so severe a deterioration in debt metrics as to threaten Brazil's investment-grade rating," the agency said in a statement.

Moody's cut Brazil's rating to Baa3, its lowest investment grade level, from Baa2. It also assigned a stable outlook to the new rating, which means it is not likely to change over the next 12-18 months.

"The stable outlook is a relief for the government," said Zeina Latif, chief economist at XP Investimentos. "In a way, they're giving them the benefit of the doubt."

Brazil needs economic growth of 2 percent coupled with a primary budget surplus of 2 percent of GDP to stabilise its debt ratios, Moody's analyst Mauro Leos said in a phone interview.

Government revenue has plunged since the beginning of the year, however, as Brazil sinks into a deep recession expected to last through 2016.

Further clouding the economic outlook is a growing political crisis that has raised questions about Rousseff's ability to serve out her term.

Leos said it was tough to know how a possible impeachment of Rousseff would affect the rating.

"If there are unexpected events that complicate the outlook, such as this one you mentioned, then we would have to assess how significant they are," he said.

"LESS WORSE THAN EXPECTED"

The possibility of a downgrade has spooked politicians as well as investors as it would increase borrowing costs to the government and Brazilian companies alike.

Finance Minister Joaquim Levy said the Moody's statement "shows the priorities that we need to have with regard to maintaining the quality of our public debt."

Planning Minister Nelson Barbosa said he thought Brazil would not lose the investment grade rating, calling the country's fiscal trajectory "sustainable."

Levy has been pursuing a series of spending cuts and tax hikes aimed at curbing budget deficits that had spiralled during Rousseff's first term in office.

"The news was less worse than expected since investors were beginning to believe that Moody's would try to catch up with S&P and leave Brazil closer to losing investment grade," said Alexandre Póvoa of Canepa Asset Management in Rio de Janeiro.

(Additional reporting by Alonso Soto, Guillermo Parra-Bernal, Luciana Otoni, Flavia Bohone and Anthony Boadle; Editing by Diane Craft, Chris Reese and Bernard Orr)

By Walter Brandimarte