(Updates with Senate approval)
By Jamie McGeever and Ricardo Brito
BRASILIA, Oct 22 (Reuters) - Brazil's Senate on Tuesday approved a sweeping overhaul of the country's pension system to stabilize public finances and restore business confidence, setting up President Jair Bolsonaro to sign his keystone economic proposal into law.
The Senate approved the main text of the landmark pension reform by a margin of 60-19 in a late Tuesday session before moving on to consider amendments.
Brazilian markets rallied and stocks hit an all-time high as the government cleared the final legislative hurdle for its top economic priority. Economists have said the controversial cuts to social security spending are crucial to closing a fiscal deficit that cost Brazil its investment-grade credit rating.
Pension reform has dogged successive governments over the past three decades and has been at the center of congressional debate for three years running, while the social security deficit has steadily risen.
The bill passed by the Senate aims to save the Treasury around 800 billion reais ($195 billion) over the next decade via measures that include raising the minimum retirement age and increasing workers' pension contributions.
The government and economists say it is the single most crucial measure to put Brazil's public finances on a more stable footing, boost investor and business confidence, and inject life into the sluggish economy.
"The (stock) market rallied a lot today, in part because of this passage," said Tony Volpon, chief economist for Brazil at UBS. "It looks like local investors who have been buying the market in the face of foreign selling are beginning to win the argument."
Brazil's benchmark Bovespa stock index rose 1.1% to close at 107,197 points, breaking above 107,000 points for the first ever. The real rose more than 1%, touching 4.06 per dollar for the first time in over two weeks.
Overhauling Brazil's costly social security system was Bolsonaro and Economy Minister Paulo Guedes' No. 1 economic reform push during their first year in office.
Its passage through the lower house of Congress in July, sending it to the Senate, helped give the central bank the cover it needed to cut interest rates. Failure to pass pension reform would lead to higher risk premia in local markets, the central bank repeatedly warned this year.
Brazil's public finances are extremely stretched due in part to hefty social security outlays, but also because tax revenues have fallen far short of expectations due to weak growth.
The economy is on track to grow by less than 1.0% this year, lower than the previous two years and well below the 2% or more most economists and the government expected at the start of the year.
The government's original pension reform bill envisaged savings of 1.237 trillion reais over the next decade. That was diluted to just over 900 billion reais in the lower house, then down to around 800 billion reais in the first round of voting in the Senate.
$1 = 4.07 reais Reporting by Ricardo Brito and Jamie McGeever Editing by Brad Haynes, Steve Orlofsky, Tom Brown and Richard Chang