(Adds finance minister comments)
By Bruno Federowski
SAO PAULO, March 15 (Reuters) - Moody's Investors Service on Wednesday revised upward the ratings outlook for Brazil's sovereign rating to stable from negative, saying Latin America's largest economy was poised to exit its deepest recession on record.
In a statement, Moody's Vice President Samar Maziad said a stabler macroeconomic outlook is likely to bolster the government's reform agenda, supporting Brazil's Ba2 rating.
Concerns over potential spillovers from fiscal woes at state-controlled oil company Petróleo Brasileiro SA and at state governments have also abated, he added.
President Michel Temer said in statement that the outlook change was recognition by Moody's of his government's "efforts to recover credibility in the Brazilian economy, reduce inflation and restore growth."
Finance Minister Henrique Meirelles said Moody's move reflected improved fundamentals in an economy that is beginning to turn around, the approval of a cap on federal spending and the advance of reforms of the pension system and labor laws.
Some analysts have been turning slightly more optimistic about Brazil's economic prospects amid fickle signs of a rebound as Temer advances with structural reforms.
Still, many remain cautious due to corruption investigations ensnaring senior members of the administration and a larger-than-expected contraction in the economy at the end of last year.
Front-month Brazilian real future contracts extended gains following Moody's decision. Spot markets for the currency and stocks were closed at the time.
Moody's last cut Brazil's sovereign debt in February 2016, downgrading it by two notches into junk territory as former President Dilma Rousseff struggled to shore up public finances.
Now, the agency said it could upgrade it for the first time since 2011 if structural reforms, including a revamp of the country's costly pension system, boost economic growth or lower government debt.
Following the ouster of his leftist predecessor last year, Temer spearheaded a campaign to balance Brazil's budget, amending the constitution to limit growth of government spending for two decades.
A sovereign ratings upgrade will also hinge on signs of commitment to the spending ceiling after a highly uncertain 2018 presidential election, which Temer has pledged to abstain from, Moody's said.
On the other hand, threats to the "implementation of fiscal reforms and compliance with the spending cap -- particularly delays in passing social security reform -- would put negative pressure on the rating," Maziad wrote.
Brazil is rated BB with a negative outlook by rival agencies Standard & Poor's and Fitch Ratings. (Reporting by Bruno Federowski; Editing by Daniel Flynn and Jonathan Oatis)