MEXICO CITY -- Having hitched its fortunes to free trade with the United States for over two decades, Mexico faces a hard road to find new markets if U.S. president-elect Donald Trump carries out threats to force significant changes to the terms of the deal.

Pitching a protectionist message to U.S. workers disaffected by globalization, Trump has vowed to rescind the North American Free Trade Agreement (NAFTA) if he cannot renegotiate it and halt the migration of jobs south to cheaper Mexican factories.

If Trump follows through, Mexican policymakers say they will have to try to offset losses in U.S. trade by promoting closer commercial ties with Asia and Latin America, as well as seek to work alongside Canada to defend NAFTA.

From 1994, NAFTA united Mexico with the United States and Canada in a single free trade area, modernizing its economy. Backers argue it made the whole continent more competitive, but Trump complains it hollowed out U.S. manufacturing.

The U.S. presidential campaign, which culminated with Republican nominee Trump's surprise victory over Democrat Hillary Clinton on Tuesday, has been steeped in protectionist rhetoric, spooking Mexico's government and battering the peso currency. It dropped to a historic low after Trump's victory.

Mexico had hoped the Trans-Pacific Partnership (TPP), a broader accord signed this year - but not ratified - between the NAFTA partners and nine other nations, could serve as a forum to tweak U.S. trade ties and extend Mexico's reach into Asia.

Derided by Trump and even Clinton, TPP now looks to be a hard sell.

"If TPP doesn't flourish, Mexico needs to have another strategy to strengthen trade with Asia," Mexican Economy Minister Ildefonso Guajardo told Reuters a few days before the U.S. election.

Mexico would also seek to be "twice as aggressive" in strengthening trade ties with both Asia and Latin America if the next U.S. government is against NAFTA, he added.

Trump has called NAFTA the "worst deal ever" and threatened to impose tariffs of up to 35 percent on Mexico's goods. He has also pledged to build a giant wall along the border with Mexico to halt the influx of illegal immigrants.

On a visit to Mexico to meet President Enrique Pena Nieto in late August, he struck a more conciliatory tone, stressing the importance of keeping "manufacturing wealth" in North America, but also highlighting the need to "update" NAFTA.

Mexico has said it could "modernize" NAFTA if the other two members agree. But officials are opposed to changing the basics of the agreement, and hope Canada will back them up.

"Closing ranks with Canada will be vital for upholding NAFTA," Victor Manuel Giorgana, a lawmaker from the ruling Institutional Revolutionary Party who heads the lower house foreign relations committee, said last week. "We can't have one of the countries trying to impose its own particular vision."

To broaden its trading reach, Mexico has been in talks with countries including South Korea, Argentina and Brazil, and those could be accelerated if necessary, government officials say.

Another person familiar with the government's thinking, speaking on condition of anonymity, said before the vote that a Trump victory was likely to precipitate a drive by the government to seek a free trade deal with China.

That could face opposition from Mexican companies wary of Chinese competitors but there is a growing belief among business leaders that Mexico must broaden its trade base in Asia.

"Our exports need to be diversified," said Cesar Castro, president of a regional chapter of electronics industry group Canieti, and logistics chief of U.S. manufacturing firm Jabil Circuit in Mexico. "We should have done it a while ago."

Trade between Mexico and the United States is worth about half a trillion dollars a year, giving Mexico a large surplus.

But the country runs large deficits with its top Asian partners, especially China. More than 90 percent of $76 billion in 2015 bilateral Chinese trade, including Hong Kong, were imports.

Mexico's government has sought to strengthen ties with China under Pena Nieto, who in less than four years has met his Chinese counterpart six times - twice the number his predecessor Felipe Calderon managed in six years.

To bolster his outreach to Asia, Pena Nieto plans to visit Asian signatories of TPP early next year, according to two people familiar with the matter.

First and foremost, however, Mexican officials aim to preserve as much existing trade as possible with the United States, pointing to evidence of the shared benefits of increasing U.S. and Mexican economic integration.

A 2014 study by the Boston Consulting Group on the world's 25 top exporting nations found that Mexico and the United States had improved their competitiveness against all the other economies on the list during the preceding decade.