(Updates with Brazil's Bovespa closing little changed as Petrobras, Copel erased gains)
RIO DE JANEIRO, June 24 (Reuters) - Brazil's benchmark Bovespa index erased most of its gains on Tuesday as concern about government meddling in state-run companies knocked down shares of oil company Petrobras and power utility Copel.
Shares of the oil company, formally known as Petroleo Brasileiro SA, had risen more than 2 percent during the session as foreign investors snapped up Brazilian shares following two days of declines.
Investors were particularly keen on shares of state-run companies, which they said they believe can benefit the most if President Dilma Rousseff loses her re-election bid in October. Although she remains a favorite to win, opinion polls have shown she has been losing popularity among voters.
But Petrobras shares quickly tumbled, closing down 3.6 percent, after the government announced it was assigning to the company additional production rights to four oil fields off the country's southeast coast.
Analysts say Petrobras is unable to take on more projects given its already thinly stretched financial situation. They fear the government is forcing it into additional exploration fields to generate more revenue for public coffers.
Similarly, shares of Copel initially gained more than 3 percent after regulators allowed the company, which is controlled by the state of Paraná, to increase its energy rates by 35 percent on average.
The shares closed 0.2 percent lower, however, after the company's board suspended the increase because of objections from Paraná's governor, Beto Richa.
Brazil's Bovespa index, which had gained more than 1 percent during the session, closed only 0.1 percent higher. Other Latin American bourses rose slightly as the major Wall Street stock indexes hit records, before ending down for the day.
In currency markets, the Brazilian real and the Mexican peso lost 0.4 and 0.3 percent, respectively, as the U.S. dollar gained broadly on the back of stronger-than-expected U.S. housing and consumer confidence data, which increased expectations of a more hawkish Federal Reserve.
(Reporting by Walter Brandimarte in Rio de Janeiro and Priscila Jordão in São Paulo; Editing by Steve Orlofsky)