MEXICO CITY—Ford Motor Co.’s decision to cancel a planned $1.6 billion assembly plant in the Mexican industrial city of San Luis Potosí caught the nation’s elected officials off guard and represents a major blow to one of the main engines of Mexico’s economy.

As recently as December, Ford had confirmed to local and regional officials that the company planned to push ahead with the investment, even after being criticized by President-elect Donald Trump during his campaign. The governor of the state of San Luis Potosí spent...