In an industrial park five miles east of downtown Tijuana, Ariel Ceja toils in a white room bustling with assembly workers hunched over blue tables.

San Diego-based 3D Robotics moved into this once-vacant spot in June, producing affordable drones and electronic parts destined for customers in the U.S. and around the world.

It is just one of many American companies streaming to Mexico to open high-tech factories in a reversal of the outsourcing trend in years past. Called nearshoring, businesses are moving production to Mexico, Canada and other nearby countries to take advantage of their proximity to the U.S.

“Recently, I have been seeing more American companies bringing production here,” said Ceja, who started working for 3D Robotics a month ago. During the 1990s, “there were more Asian companies coming in — Japanese, Korean — but that has changed.”

It’s not just in Tijuana. Manufacturing plants are also opening in Mexican cities such as Guadalajara and Mexico City, bringing a wave of new jobs to a country recovering from the economic downturn and still fighting constant drug violence.

From 2009 to 2012, foreign investment in Mexico jumped more than 50 percent to $7.4 billion, and exports from foreign-owned factories also grew 50 percent to $196 billion, according to one industry group that tracks maquiladoras, or assembly plants in Mexico that are owned by foreign companies. After plunging during the economic recession, employment also has jumped 25 percent to more than 2 million.

“Sometime in the last year, we reached a crossover point where it became cheaper to make a lot of goods in Mexico than in China,” said Hal Sirkin, a senior partner at Boston Consulting Group. “A lot of American companies are looking or moving.”

The global recession and its aftermath forced companies to rethink their supply chain. Faced with rising wages in China and high oil prices, many are reconsidering the appeal of manufacturing close to home, especially small and medium-size businesses without the bargaining clout of Apple and Wal-Mart.

Those businesses are finding a skilled workforce for high-tech manufacturing in Mexico. The country has doubled the number of post-secondary public schools, many devoted to science and technology. Former President Felipe Calderon last year bragged that Mexico was graduating 130,000 technicians and engineers a year, more than Germany or Canada.

The educated labor pool has attracted the car industry. Mexico has gained at least 100,000 auto-related jobs since 2010, according to a Brookings Institution report. Nissan, Honda, General Motors and Ford have all announced plans to expand in coming years.

Companies looking to bring production closer to home rank Mexico as their No. 1 choice, according to a survey from consulting firm AlixPartners.

The tipping point may have come last year when manufacturing costs in Mexico, when adjusted for productivity, dropped below those in China, according to a Boston Consulting Group report. Within two years, the average cost of production in Mexico will be 6 percent below China and as much as 30 percent lower than countries such as Japan and Germany.

“Companies are bringing back parts of manufacturing to Mexico. They are saying, ‘We want our manufacturing process close to our engineers; we want our inventory next to our customers so it’s easier to ship,’ ” said Joe Mazza, a partner at advisory and accounting firm McGladrey in Los Angeles. “There are also many companies in China that are not exiting China, but reducing their manufacturing and bringing some to Mexico.”

With all its advantages, Mexico still has its fair share of problems. Companies that don’t produce their own goods can have a hard time finding the right third-party manufacturer in a country that can’t compete yet with China’s dense supplier base and strong manufacturing infrastructure. Mexico also just passed fiscal reforms that include raising taxes on U.S.-owned companies and other businesses, increasing worries that foreign firms might leave the country.

Despite these challenges, more U.S. companies will consider locating factories in Mexico in the coming years, analysts said.

“This is the return of manufacturing in Mexico,” said Scott Stanley, senior vice president of NAPS, which aids companies setting up factories in Mexico. “Every month it seems like there are more and more companies moving. There is no sign of that trend slowing down.”