Carmakers from Nissan Motor Co. to Mazda Motor Corp. are churning out record numbers of vehicles in Mexico destined for consumers abroad. Yet some executives are worried that the factory hum will slow in coming years as exports get bogged down by congestion at the nation's ports.

The government has targeted 70 billion pesos ($4.6 billion) for port infrastructure through 2018, including building four new terminals in Veracruz. Some automakers are skeptical that the goal will be met or will be enough to handle the more than 5 million vehicles Mexico expects to produce annually by 2020, a 56 percent increase from the country's 2014 output.

In the past two-and-a-half years, car manufacturers including Toyota Motor Corp. and Daimler AG, have invested or promised $22.6 billion for auto and parts plants, according to the government. That success story, which made the sector the largest source of foreign cash in the country, may be imperiled if the government doesn't speed up plans for infrastructure improvements.