(Adds Moody's reaction, updates market prices)
By Maria Carolina Marcello and Jamie McGeever
BRASILIA, Oct 23 (Reuters) - Brazil's Senate on Wednesday gave its final seal of approval to a sweeping overhaul of the country's pension system, bringing to a close months of political wrangling over the government's keystone policy to stabilize public finances and boost growth.
The landmark bill, which aims to generate savings of 800 billion reais ($197 billion) over the next decade through a range of measures like raising the retirement age and increasing workers' contributions, now awaits presidential ratification.
Senate President Davi Alcolumbre said that should be done by Nov. 19, once President Jair Bolsonaro returns from a series of official visits to Asia.
Investors, economists and credit ratings agencies welcomed the news, even though it was effectively a formality after the main text of the bill was overwhelmingly approved on Tuesday.
Brazil's benchmark Bovespa stock index rose to a fresh record high just shy of 108,000 points, and the real firmed to around 4.03 per dollar, the strongest in six weeks.
Samar Maziad, senior analyst at ratings agency Moody's, said the Senate's green light completes a "crucial step towards preserving Brazil's fiscal sustainability," and that the reform supports Brazil's credit profile and Ba2 sovereign debt rating.
"We expect the authorities to continue pushing their structural reform agenda as they seek to improve growth on a sustained basis over the coming years by encouraging private sector investment in infrastructure, and simplifying the tax regime," Maziad said in a statement.
The Ba2 rating is non-investment grade, and the outlook is stable. In a report last month, Moody's said failure to pursue further reforms and control spending could mean no "material improvements" in Brazil's credit profile for years to come.
Roberto Secemski, Brazil economist at Barclays, said that although the pension reform "saga" had come to a "happy ending," other measures were still needed to turn the country's fiscal and economic fortunes around.
While the bill's approval means Brazil will almost certainly avoid sliding back into recession, its deficit and debt dynamics will likely take years to improve.
"The majority of the reform savings, which will come from a slower pace in expenditure growth rather than outright reduction in spending, is back-loaded," Secemski wrote in a client note.
"The market's focus will now likely shift toward economic growth. We will monitor the new fiscal measures expected to be announced by (Economy) Minister Paulo Guedes next week," he said.
$1 = 4.03 reais Reporting by Maria Carolina Marcello and Jamie McGeever Editing by Chris Reese, Tom Brown and Richard Chang