(Adds comment, economic context)
By Alonso Soto
BRASILIA, March 24 Standard & Poor's cut Brazil's sovereign debt rating closer to speculative territory on Monday in a blow to President Dilma Rousseff, whose efforts to stir the economy from a years-long slump have eroded the country's finances.
Brazil had its long-term debt rating downgraded to BBB minus, the agency's lowest investment-grade rating. S&P changed its outlook to stable from negative, meaning further downgrades are unlikely for now, which will come as a relief for both politicians in Brasilia and financial markets.
The move was widely expected but the timing surprised some investors.
As it came ahead of an October election in which Rousseff will seek a second term, the downgrade will expose her left-leaning government to further accusations that it has squandered the goodwill built during a long economic boom last decade.
Brazil has suffered from slow growth that averaged about 2 percent in recent years. Rousseff has tried to revive the economy with tax cuts and social spending but has been widely criticized for intervening too much and resorting to sometimes opaque accounting moves to meet budget targets.
"The downgrade reflects the combination of fiscal slippage, the prospect that fiscal execution will remain weak amid subdued growth in the coming years, a constrained ability to adjust policy ahead of the October presidential elections, and some weakening in Brazil's external accounts," S&P said.
The agency said that fiscal credibility had been "systematically weakened" following cuts in the government's main budget target, and that loans by state-run banks had "undermined policy credibility and transparency."
A central bank spokesman declined comment on the downgrade. A spokesman for Rousseff referred comment to the finance ministry, which did not immediately respond to phone calls.
The short-term effect of the move on financial markets was unclear, analysts said. Some investors could sell Brazilian assets because of policies forcing them to hold higher-quality stocks and bonds, while others may focus on the fact that S&P is unlikely to downgrade Brazil any further.
However, S&P's move could prompt peers Moody's Investors Service and Fitch Ratings to signal they may follow with a downgrade of their own.
"The natural tendency for markets tomorrow is the fear that there could be a chain reaction and other agencies may do the same," said Ariovaldo Santos, manager of floating-rate assets at H.Commcor in Sao Paulo.
Rousseff's government has worked to restore its credibility on budget targets in recent months, but investors are worried that she will resort to more unorthodox accounting moves and raise spending as she seeks re-election. (Additional reporting by Priscila Jordao; Editing by Brian Winter, Kieran Murray and Bernard Orr)