Toyota and Mazda announced Friday they are jointly building a $1.6 billion assembly plant in the U.S., buying a stake in each other, and developing electric vehicles.

Under the agreement, Toyota, the world’s second-largest automaker, will buy a 5 percent stake in Mazda, Japan’s sixth-largest carmaker. The smaller automaker, meanwhile, will take a 0.25 percent share in Toyota. The U.S. plant would have the capacity to make 300,000 vehicles annually and create up to 4,000 jobs , the companies said. The plant, whose location is yet to be determined, will begin work in 2021 pending regulatory approval, the companies said. Mazda will make new crossovers for the North American market at the plant. Toyota said it plans to produce Corollas for the North American market there. The goal, the companies said, was to respond more quickly to the needs of its customers.

President Trump praised the announcement on Twitter, calling it a “great investment in American manufacturing.” The decision by the automakers could be seen a victory for Trump who had campaigned for president vowing to bring back U.S. manufacturing jobs—though many of these jobs were returning in smaller numbers for a few years.  

Still, the announcement comes at a surprising time for the U.S. auto industry: Figures released this week showed a continuing decline in car sales, a trend driven last month mostly by weaker-than-expected sales of trucks. General Motors, Ford, and Chrysler—the big-three U.S. automakers—were particularly affected, each seeing larger-than-expected sales declines. Sales of Mazda fell, too. Toyota was one of the few companies that saw an increase in sales.

Lower demand from consumers, as well as increased emissions and regulatory standards, the rise of self-driving technology, and ride-sharing services makes the auto industry a challenging sector. The two companies acknowledged as much in their announcement.

“With the future of the industry in mind, in addition to leveraging their individual strengths to further improve technologies and reinforce their business foundations, Toyota and Mazda aim to deepen collaboration and achieve sustainable growth through their partnership, rising to face and overcome these pressing challenges,” the statement said.