SÃO PAULO— Moody’s Investors Service downgraded its credit rating for Brazil to one notch above junk status on Tuesday, citing weak economic growth and rising government spending, dealing another blow to embattled President Dilma Rousseff’s political standing

Moody’s lowered Brazil’s government bond rating to Baa3 from Baa2, and changed its outlook to stable from negative. The change still leaves the country’s ratings out of line with other countries in a similar debt situation, but Brazil’s large, diverse economy and “low susceptibility to event risk” help justify the investment grade level, Moody’s said.

Brazil’s government last month slashed a key fiscal target as it struggles to boost tax revenue and get spending under control. It now expects to have a primary budget surplus, which is a measure of its ability to save and cut debt, equal to 0.15% of gross domestic product, compared with the previous target of 1.1% of GDP.

“It will be challenging for Brazil to achieve and sustain improving fiscal trends,” Moody’s said. “The numbers confirm that the authorities have been unable to deliver primary surpluses large enough to prevent an increase in debt ratios in 2015-2016.”

GDP growth of at least 2% and primary surpluses of at least 2% of GDP will be required to stabilize debt ratios, according to Moody’s, and Brazil is unlikely to meet these conditions this year or next.

This will likely lead to the continued deterioration of government debt burdens and may only stabilize toward the end of the administration, the ratings agency said.

The downgrade put the rating agency in line with Standard & Poor’s Ratings, which also has Brazil’s rating one notch into investment-grade territory.

Despite the downgrade, Moody’s move to a stable outlook could be considered positive, suggesting no more changes in the short term.

“It was good that Moody’s didn’t cut by two notches, and has a stable outlook. It amounts to saying that, despite the fiscal deterioration, Brazil can still keep its investment grade,” said Jankiel Santos, chief economist at BES Investimentos do Brasil in São Paulo.

Investors had expected the downgrade, but were surprised when Moody’s offered Brazil a stable outlook. The market had largely baked in a negative outlook following the downgrade in light of the earlier downgrade by S&P.

“Expectations were below investment grade or moving towards that,” said Kathryn Rooney Vera, senior macro strategist at Bulltick Capital Markets.

Brazil’s benchmark U.S. dollar denominated notes due 2025 rose 1.5% after the downgrade was announced and the Brazilian real appreciated 1% against the dollar. Stock trading closed shortly before Moody’s announcement, with the Ibovespa index closing 0.6% lower.

After growing just 0.1% in 2014, Brazil’s economy is expected to contract 1.8% this year and post no growth in 2016, according to a weekly central bank survey with economists.

Growth has been weak and may remain so, and consumption has been hurt by adverse labor market conditions, Moody’s said. Also, a decline in employment and reduction in real wages have put a dent in household spending.

The sluggish economy, and a spreading corruption scandal involving state-controlled oil company Petróleo Brasileiro SA, have driven President Rousseff’s approval ratings to record lows. Her government is now struggling to get its economic proposals passed in Congress, and Ms. Rousseff faces a threat of impeachment over some fiscal maneuvers from her first term.

“Whether this will cause the politicians to react and approve the fiscal adjustment that’s necessary, we’ll have to wait and see,” said David Fleischer, a emeritus professor of political science at the University of Brasília. “Because if Brazil gets downgraded to junk, a lot of people are going to lose their shirts.”

Investors are awaiting news from Fitch to see if Brazil is in near-term danger of falling below investment grade. A knock to below investment grade by two out of the three ratings firms, Ms. Rooney Vera said, would signal a selloff by pension funds, insurance companies and others who are limited in their ability to hold bonds that are below investment grade.

“You can’t underestimate the impact of selling pressure,” she said. “It would be very very bad for Brazil. It would send bond yields higher, making the cost of financing their fiscal deficit higher. You’d see more pressure on companies that borrow in the international markets as well—those yields would go higher. You’d have public debt ratios also increasing.”