By Bruno Federowski BRASILIA, Jan 26 (Reuters) - Brazilian markets extended a rally on Friday as traders bet leftist former President Luiz Inácio Lula da Silva would be barred from running in this year's elections after an appeals court upheld his conviction for corruption. The Brazilian real firmed as much as 1.2 percent before paring gains to around 0.1 percent due to profit-taking. The benchmark Bovespa stock index touched an all-time high at 84,523. Lula, who is leading opinion polls and has vowed to undo some of President Michel Temer's austerity efforts, could now be ineligible to stand for election under Brazil's "clean record" law, which bans political candidates whose convictions have been upheld by an appellate court. But Lula still has options. An electoral court must make the final ruling on his candidacy and would only do so once he registers. The court's decision on Wednesday "reduces the risk of unorthodox policymaking and opens up space for candidates that support market-friendly reforms," Magliano brokerage analyst Carlos Soares Rodrigues said. Blue-chips, including shares of banks and state-controlled oil company Petróleo Brasileiro SA, added the most points to Brazil's benchmark index, but miner Vale SA's stock tracked iron ore prices lower. The Chilean peso fell 0.3 percent as rising on-warrant copper stocks weighed on prices of the industrial metal. But the Mexican peso rose 0.2 percent, tracking global weakness in the U.S. dollar. The dollar fell against a basket of currencies on Friday as senior U.S. officials' comments this week in favor of a weak greenback reverberated through currency markets. After U.S. President Donald Trump said on Thursday he ultimately wanted the dollar to be strong, the currency pared some losses, but it was on track for its biggest monthly drop since March 2016. Key Latin American stock indexes and currencies at 1420 GMT: Stock indexes daily % YTD % change change Latest MSCI Emerging Markets 1266.65 0.25 9.06 MSCI LatAm 3191.66 -0.32 13.22 Brazil Bovespa 83979.00 0.36 9.92 Chile IPSA 5801.94 -0.17 4.27 Chile IGPA 29175.19 -0.14 4.27 Venezuela IBC 2923.54 1.39 -90.78 Currencies daily % YTD % change change Latest Brazil real 3.1543 0.12 5.04 Mexico peso 18.5675 0.23 6.09 Chile peso 600.72 -0.28 2.32 Colombia peso 2814.4 -0.89 5.96 Peru sol 3.214 -0.12 0.72 Argentina peso (interbank) 19.5050 0.46 -4.64 Argentina peso (parallel) 19.91 0.60 -3.42 (Reporting by Bruno Federowski; Editing by Lisa Von Ahn)