(CNN Money) -- Toyota and Mazda have announced plans to build a $1.6 billion manufacturing plant in the United States that will create as many as 4,000 jobs.
The Japanese automakers said in a statement Friday that the facility would be operational by 2021, but did not specify where it would be built.
Mazda plans to build new crossover vehicles for the U.S. market at the plant, while Toyota will produce its Corolla model there.
The move is likely to be seen as a win for President Trump, who attacked Toyota earlier this year over its plans to build a new factory in Guanajuato, Mexico. He threatened to slap a "big border tax" on Toyota cars if the plant isn't built in the U.S.
Toyota had intended to build Corollas -- the world's best-selling car -- at the plant in Mexico. On Friday, the Japanese firm said it now plans to produce Tacoma pickup trucks at the plant in Mexico instead of the Corolla.
Trump welcomed the news, describing it on Twitter as a "great investment in American manufacturing."
All Corollas currently sold in the U.S. are made in Ontario, Canada or Mississippi. Toyota also has plants in Indiana, Kentucky and Texas. Mazda has not made cars in the U.S. since a joint partnership with Ford unraveled earlier this decade.
The prospect of a new factory in the U.S. could set off a competition among states over its location. State and local governments are likely to offer subsidies and tax incentives to land the factory, which could produce as many as 300,000 vehicles a year.
Toyota has said it plans to invest $10 billion in the U.S. over the next five years.
Toyota and the much smaller Mazda also announced a new business partnership on Friday -- the latest example of consolidation in the auto industry. Toyota will pay about $450 million for a 5% stake in Mazda as part of the deal, while Mazda will buy a stake of the same value in Toyota.
In addition to the new factory in the U.S., the automakers said they would collaborate on safety and technology for electric vehicles.
Toyota lost its title as the world's top automaker to Volkswagen in 2016 after four consecutive years of dominance. General Motors last won the title in 2011. The traditional industry kings also now face a challenge from a rival alliance anchored by Renault and Nissan.
Toyota president Akio Toyoda made the case Friday that industry consolidation is needed because automakers face increased competition from tech firms including Apple, Amazon and Google that are developing self-driving cars.
"New players from totally new business are challenging us," he said at a press conference. "That's why I feel it has become increasingly important for us automakers to gather new partners without seeing things in confrontational perspectives."