Although Donald Trump’s election was shocking to the Mexican government, President Enrique Peña Nieto was one of first world leaders to congratulate President-elect Trump and seems ready to negotiate a new economic deal to prevent a trade war.

Mexico is very worried that President Trump will actually follow through on his promises to conduct massive deportations, to apply new trade tariffs and to demand renegotiation of the North American Free Trade Agreement. Pena Nieto’s invitation for Trump to make an official Mexican visit in August now seems brilliant.

The Mexican government promised to intervene in currency markets to prevent any disruptive fall in the peso from the U.S. elections. But Mexico’s financial markets have been hammered since Election Day, with their peso currency crashing by 13 percent.

This week’s panic selling was worse than the start of Mexico’s 1994 “Tequila Crisis.” That disaster came a year after the signing of NAFTA in December 1993 by Mexico’s President Carlos Salinas and U.S. President Bill Clinton.

NAFTA suddenly opened unlimited access to Mexico’s formerly protected consumer and industrial markets. The ensuing U.S. export boom saw America’s balance of payments surplus with Mexico spike over 1,000 percent to $29.4 billion in 1994. But the resulting capital flight forced Mexico’s central bank to raise interest rates, dramatically.

Mexican banks began to collapse as borrowers could no longer pay loans. The Mexican government was forced to let the peso’s exchange rate “float.” With the peso suffering a 50 percent devaluation and Mexico about to default, the country had to ask the U.S. for a bailout. Mexico still has access to a $90 billion IMF credit line granted 22 years ago.

Mexico has huge risk in a trade war with President Donald Trump and the United States. About 90 percent of U.S.-based fortune 500 companies now have made substantial investments in Mexico. According to the U.S. Bureau of Economic Analysis’ report from 2012, U.S. multinational enterprises employed 1,106,700 people in Mexico, but Mexican companies only employ 68,800 in the United States.

America’s trading relationship with Mexico is not equal, but a number of U.S. companies and their workers do benefit from NAFTA. Mexico is America’s second-largest export market, with $236 billion, or 15.7 percent, of all U.S. exports in 2015. That is up 468 percent since NAFTA was signed in 1993.

But NAFTA has been so remarkably successful that Mexico, with $400 billion in exports, is now the 12th largest export economy in the world. That has only been possible because 80 percent of Mexico’s exports go to the United States.

Mexico’s finance minister recently announced a 2017 budget of about $234 billion. That number is 2 percent less than this year’s budget, and does not provide any of the $12 billion to build a 50-foot-high concrete wall along the 1,989 mile U.S./Mexico border for which Donald Trump promised Mexico would pay.

Mexico’s President Enrique Pena Nieto’s phone call to President-elect Trump early on the morning of November 9 has already sparked agreement for a meeting before President-elect Trump is inaugurated in January, according to Stratfor Global Intelligence.

The outreach seems to indicates that Mexico values their its relationship with the U.S. and will be “flexible” in negotiations to maintain it.