Mazda and Toyota will build a new factory in the United States, and develop electric technology.

Confirming an earlier rumor, Mazda has confirmed it is forming a strategic and capital alliance with Toyota, one of the world's largest car makers.

The companies have been talking about expanding their partnership for at least two years. In a statement published online, Mazda explains it will form a joint-venture with Toyota to build vehicles in the United States.

The new $1.6 billion plant will initially have an annual capacity of about 300,000 cars. It will manufacture Mazda crossovers -- including models that have not been introduced yet -- and the North American-spec variant of the Toyota Corolla. Consequently, production of the Tacoma pickup will shift to a new factory in Guanajuato, Mexico.

The plant is tentatively scheduled to be up and running by 2021. It will create up to 4,000 new jobs, but Mazda and Toyota haven't decided where to build it yet.

The companies also pledged to jointly develop technology for electric cars, as well as connected-car and safety features like vehicle-to-vehicle (V2V) communication systems. They share the Utopian vision of "creating a mobile society devoid of accidents."

Finally, Mazda and Toyota will continue working together on common products like the Mazda2-based Yaris iA. Notably, Toyota will supply Mazda with a two-box commercial van that it can sell on the Japanese market. The alliance will likely spawn additional common products in the coming years.

Toyota is investing 50 billion yen (roughly $454 million) to acquire a five-percent stake Mazda. Mazda is buying a 0.25-percent stake in Toyota for an undisclosed amount of money. Both transactions will take place in early October.