(Updates prices, adds details from Mexico) By Bruno Federowski

BRASILIA, Jan 16 (Reuters) - Brazilian stocks on Tuesday edged up to an all-time high as optimism over the nation's economic prospects kept an early-year rally alive. The benchmark Bovespa stock index closed up 0.1 percent at 79,831.8, after earlier breaching the 80,000 mark for the first-time ever to hit 80,246.331. Demand for Brazilian assets has been underpinned by expectations that stronger economic growth lifts corporate earnings in 2018. Brazil's gross domestic product is expected to grow almost 3 percent in 2018, strengthening a comeback from its deepest recession in decades. Still, analysts say the positive outlook hinges on policymakers' ability to plug a growing budget deficit and implement market-friendly reforms as the nation heads into wide-open presidential elections.

"Insufficient progress towards fiscal consolidation could potentially jeopardize the recently achieved gains in macroeconomic performance and asset prices," Goldman Sachs economist Alberto Ramos wrote in a report.

Shares in petrochemical firm Braskem SA led gains on the index after analysts at Itaú BBA upgraded their recommendation on the stock to "outperform" from "market perform." Foreign exchange markets saw limited moves, though the Brazilian real fell 0.58 percent against the dollar after rising over 3 percent in the first half of January. Mexico's peso strengthened for a second day on hopes that U.S. President Donald Trump take a softer stance on trade negotiations.

The Mexican currency rallied on Monday following a report that said Trump may be shying away from terminating the North American Free Trade Agreement (NAFTA). Mexico sells around four-fifths of its exports to the United States so it is particularly vulnerable to U.S. protectionism.

The country's S&P/BMV IPC stock index rose by more than 0.2 percent, boosted by shares in airline Volaris, which rose by almost 6 percent as it confirmed plans announced in November to buy dozens of Airbus jets.

Highlight
Off