Mexico had a closed and struggling economy in the mid-1980s, with little American investment, and most Mexicans viewed the U.S. as their historic enemy. After Mexican drug lords tortured and murdered a U.S. Drug Enforcement Administration agent, President Ronald Reagan temporarily closed the border.

Much has changed in the ensuing 30 years. Under the North American Free Trade Agreement, the two countries trade half a trillion dollars worth of goods and services each year. There is cooperation on security, migration and the environment. Wal-Mart Stores Inc. has become Mexico’s largest private-sector employer. Americans couldn’t make enough Super Bowl guacamole without Mexican avocados.

President Donald Trump’s vows to move quickly to renegotiate the Nafta accord, build a wall along the border and crack down on immigration are testing those bonds. He has said the alliance fostered by his four predecessors, two Republicans and two Democrats, has undermined America’s economy by encouraging U.S. manufacturers to relocate jobs south of the border, and its security by what he calls lax enforcement of immigration restrictions.

The U.S. trade deficit with Mexico, he notes, has increased. Mexico “has outnegotiated us and beat us to a pulp through our past leaders,” he said on Jan. 27. “They’ve made us look foolish.” On Thursday, he told U.S. lawmakers he is aiming to “kick-start” the Nafta renegotiation process.

The escalating tension has called into question whether the friendliness of the past three decades will endure, or whether the two neighbors will revert to the hostility common during the first 170 years of U.S.-Mexican relations. Much will depend on whether early signs of a working relationship between lower-level officials will overcome President Trump’s propensity to rile the Mexican government.