Bill Chan had never set foot anywhere in Mexico, let alone the lonely stretch of desert in the north of the country where he abruptly decided to build a $300 million factory. But that seemed a trifling detail amid the pressure to adapt to a swiftly changing global economy.

It was January 2022, and Mr. Chan’s company, Man Wah Furniture Manufacturing, was confronting grave challenges in moving sofas from its factories in China to customers in the United States. Shipping prices were skyrocketing. Washington and Beijing were locked in a fierce trade war.

Man Wah, one of China’s largest furniture companies, was eager to make its products on the North American side of the Pacific.

“Our main market is the United States,” said Mr. Chan, chief executive of Man Wah’s Mexico subsidiary. “We don’t want to lose that market.”

That same objective explains why scores of major Chinese companies are investing aggressively in Mexico, taking advantage of an expansive North American trade deal. Tracing a path forged by Japanese and South Korean companies, Chinese firms are establishing factories that allow them to label their goods “Made in Mexico,” then trucking their products into the United States duty-free.

The interest of Chinese manufacturers in Mexico is part of a broader trend known as nearshoring. International companies are moving production closer to customers to limit their vulnerability to shipping problems and geopolitical tensions.

The participation of Chinese companies in this shift attests to the deepening assumption that the breach dividing the United States and China will be an enduring feature of the next phase of globalization. Yet it also reveals something more fundamental: Whatever the political strains, the commercial forces linking the United States and China are even more powerful.

Chinese companies have no intention of forsaking the American economy, still the largest on earth. Instead, they are setting up operations inside the North American trading bloc as a way to supply Americans with goods, from electronics to clothing to furniture.

The Mexican border state of state of Nuevo León has positioned itself to reap the bounty. Led by a brash, 35-year-old governor, Samuel García, the state has courted foreign investment while pursuing highway improvements to ease the passage to border crossings.

Mr. García recently attended the World Economic Forum in Davos, Switzerland, to recruit more companies.

“Nuevo León is having a geopolitical planetary alignment,” the governor declared during an interview in the state capital of Monterrey, inside the government palace, a warren of grand rooms with high ceilings and balconies looking out to the jagged peaks of the Sierra Madre. “We’re receiving lots of Asians that want to come to the U.S. market.”

Since Mr. García took office in October 2021, nearly $7 billion in foreign investment has poured into Nuevo León, making the state the largest recipient after Mexico City, according to the Mexican Ministry of Economy.

In 2021, Chinese companies were responsible for 30 percent of foreign investment in Nuevo León, second only to the United States at 47 percent.

Some of this money is financing factories that will make finished products for sale in the United States. But much is focused on a broader refashioning of the global supply chain.

As the pandemic disrupted Chinese industry and jammed ports, companies with factories in the United States suffered shortages of parts made in Asia. Many are now demanding that their suppliers set up plants in North America or risk losing their business.

Lizhong, a Chinese manufacturer of automobile wheels, is erecting the company’s first factory outside Asia at an industrial park in Nuevo León. Lizhong’s largest customers, including Ford and General Motors, pressed the company to open a factory in North America, said its general manager for Mexico, Wang Bing.

A South Korean company, DY Power, which makes components for construction equipment, is considering northern Mexico as the site for a factory near a major customer in Texas.

“After going through the pandemic and the supply chain crisis, the China Covid shutdown, many North American manufacturers would like to eliminate the risk,” said Sean Seo, a Seattle-based executive for DY Power.

“Globalization has ended,” he declared. “It’s local-ization now.”

César Santos has placed a substantial bet on such pronouncements proving true.

A corporate lawyer, Mr. Santos, 65, runs a sideline enterprise as a developer in Monterrey, an industrial boomtown full of upscale restaurants, glittering shopping malls and spas.

A decade ago, he was approached by a developer in Los Angeles who was representing a Chinese electronics company that was contemplating a factory in Mexico. Mr. Santos controlled an asset of considerable interest — a 2,100-acre parcel of land.

Dotted by cactus, the property sat less than 150 miles from the Texas border. While surroundings states grappled with violence linked to drug trafficking, Nuevo León carried a reputation for security. The state boasted a highly skilled work force, given the presence of universities that churned out engineering graduates, among them Tec de Monterrey, often referred to as “Mexico’s MIT.”

The land had been his family’s cattle ranch when Mr. Santos was a child, the scene of horseback riding adventures. Now, he saw a lucrative opportunity to turn it into an industrial park.

He took a trip to China, riding a high-speed train from Shanghai to the lakefront city of Hangzhou to meet the Holley Group, which had constructed an industrial park for Chinese companies in Thailand.

“China was a country that had developed everything so fast,” Mr. Santos said. “I was really amazed.”

By 2015, he had joined with Holley and another Chinese partner to forge a joint venture, Hofusan Real Estate. They plan a grid of warehouses and factories fronted by a hotel and temporary apartments for visiting managers, plus more than 12,000 homes for workers.

The Holley Group dispatched Jiang Xin to oversee the venture. He had previously worked at the company’s project in Thailand. Mexico presented a different proposition.

“Chinese companies had no idea about Mexico, and the only things we knew were bad things, dangerous things,” Mr. Jiang said. “Then Trump came.”

When he became president in 2017, Donald J. Trump demanded that American companies abandon China. By 2018, he was slapping steep tariffs on hundreds of billions of dollars in Chinese imports.

“The tariff thing did help us,” Mr. Jiang said. “Chinese companies wanted more options. And we are one of their options.”

By the time Mr. Chan began contemplating Mexico in the fall of 2021, 27 other Chinese companies had already locked up land inside the Hofusan park. Only one large parcel remained.

Man Wah had already responded to the tariffs by building a factory in Vietnam, and using it to make products for the American market. But the soaring price of shipping beggared that strategy.

Man Wah was moving 3,500 40-foot shipping containers a month across the Pacific from Vietnam. Voyages that previously cost $2,000 were suddenly 10 times as much.

Mr. Chan used the Chinese social media platform, WeChat, to connect with Mr. Jiang. His questions were blunt. How soon could Man Wah begin construction? (Immediately.) How were the highways? (Not great, but improving.) Were there any authentic Chinese restaurants in the vicinity? (No.)

Within weeks, Man Wah had committed to purchase the land. In January 2022, Mr. Chan signed the contract before boarding a flight to Mexico, leaving his wife and two children behind in the Chinese city of Shenzhen.

While the new factory is being constructed, Man Wah has already begun producing sofas at a small, leased plant nearby.

Even before he located the temporary site, Mr. Chan loaded 70 containers full of machinery and raw materials in China, putting them on a ship bound for Mexico.

“We always do things quickly,” he said. “Don’t worry about anything, just do it.”

Man Wah does worry about a few things: hiring enough workers and cultivating local suppliers.

The company has plans to manufacture nearly 900,000 pieces of furniture per year in Mexico. That will require hiring and retaining 6,000 workers.

Man Wah is accustomed to operating in China and Vietnam, where independent labor unions are essentially banned, and where rural people stream into industrial areas in pursuit of jobs.

In Nuevo León, the unemployment rate is 3.6 percent. The surge of investment has set off a fierce competition for workers.

Savvy companies have wooed their employees with extras like quality meals and transportation to work. But Man Wah and other Chinese companies answer to bosses in China, who are conditioned toward thrift while thinking of workers as easily replaceable.

Finding local suppliers is also a challenge. Under the terms of the North American trade agreement, manufacturers must employ minimum percentages of parts and raw materials from within the region to qualify for duty-free access to the other countries in the bloc.

Three years ago, Lenovo, the Chinese computer maker, opened a new factory in Monterrey dedicated to making servers, the boxes that hold data for cloud computing.

Until last year, Lenovo flew in one crucial component — so-called motherboards — from a factory in China. But as international shipping troubles intensified, the company switched to a supplier in the Mexican city of Guadalajara.

Lenovo also stopped importing packaging materials from China, instead buying them in Mexico.

But Lenovo continues to import many key components from China, from memory devices to specialized cables.

“There’s no supply chain for these things in Mexico,” said Leandro Sardela, the company’s western operations director.

At least, not yet.