– Mexico is poised to overtake Brazil as the top Latin American automobile producer for the first time in more than a decade as surging exports to the United States spur factory openings and record output.

After nosing ahead of Brazil in the first five months of the year, Mexico is projected to hold its advantage through 2014, for the first full-year lead since 2002, according to consultant IHS Automotive.

Mexico's ascent is being fueled in part by auto sales running at the fastest pace in almost eight years in the United States, Mexico's largest market. The boom coincides with a slump in Brazilian production as domestic demand cools, setting up a shift in leadership of the Latin American industry faster than analysts predicted.

"The wind is in our sails" in Mexico, Luis Lozano, lead automotive partner at PricewaterhouseCoopers, said in a telephone interview from Mexico City. "People talk about the energy and telecom industries in Mexico, but the auto industry is going to continue as the icon of this country."

Eclipsing Brazil, where output has fallen 14 percent this year, would vault Mexico to No. 7 among the world's largest auto producers. China and the United States lead the global pack.

This year's diverging fortunes of Mexican and Brazilian auto production reflect the state of their biggest markets. Brazil-made cars and trucks are too expensive, given high labor costs and taxes, to send abroad and go mostly to local buyers. Mexican factories export eight of every 10 cars they produce — with more than half going to the United States.

The auto industry epitomizes the underlying economic fundamentals in the two countries. Economists project that the Mexican economy will grow 2.8 percent this year compared with 1.3 percent in Brazil.

Auto output in Mexico rose 7.2 percent through May to 1.31 million vehicles, bolstered by new plants for Nissan, Honda and Mazda according to the Mexican Automobile Industry Association, known as AMIA. Brazil's total was 1.27 million, according to Anfavea, Brazil's automaker association.

Mexico's proximity to the United States also gives it an advantage, as do labor costs for automakers that are about 20 percent of U.S. levels, according to PricewaterhouseCoopers.

While Mexico's exports to the United States rose 19 percent through May, Brazil's shipments to its top trading partner, Argentina, declined 28 percent, according to Anfavea. Within Brazil, consumers have slowed purchases because of tighter credit and a weakening economy.

Mexico's surge caught some industry watchers by surprise.

"At the beginning of this year, we basically did not have Mexico overtaking Brazil at any point in time," Guido Vildozo, Latin America analyst at IHS Automotive, said in a telephone interview from Lexington, Mass.

Even as exports are buoying Mexico's auto industry, the low level of domestic sales is a weak spot, according to AMIA President Eduardo Solis. New-car sales in Mexico totaled 1.06 million last year. Mexico should restrict used-car imports from the United States more stringently, he said.

"We have record production and exports and a domestic market that just isn't turning the corner," Solis told reporters June 10 in Mexico City.

Mexico's auto-production gains combined with Brazil's losses may lead to a diplomatic confrontation this year between Latin America's two biggest economies, according to Augusto Amorim, IHS Automotive's analyst for South America.

In 2012, Mexico agreed to limit car exports to Brazil for three years after a surge in Mexican shipments to Latin America's largest economy. That led to a 23 percent drop in Mexican-made vehicles exported to Brazil last year, according to AMIA.

While the pact is set to expire in March 2015, Brazil may look for ways to extend it, Amorim said. AMIA will probably meet with Anfavea and a similar trade group from Argentina this summer, Solis said.

"We are still in negotiations for both countries to have successful results," Brazil's ministry of development, industry and external commerce said in an e-mailed response.

"The commitment is to get back in 2015 to a free market," Mexico Economy Minister Ildefonso Guajardosaid last week in Mexico City.

Bill Rinna, senior manager of North American forecasts at LMC Automotive, predicts that Mexico will hold the top spot from 2016 until 2021, when Brazil wrests it back. By then, the combined auto output of the two nations would be 8.83 million vehicles, 38 percent higher than in 2013.