Through the first 10 months of this year, Toyota has sold 26,397 copies of the Yaris, up 17 percent from the same period in 2011, and 9,280 copies of the Scion xD, up 17 percent from last year. The Yaris and xD are imported from Japan, where current dollar-yen exchange rates means Toyota makes minimal profit or loses money on sales in the United States.

But the new Toyota is likely to be an addition to the automaker's lineup, not a direct replacement for the Yaris or xD, according to a Toyota spokesman. Toyota also plans to sell the car in Canada and Mexico.

The automakers announced the deal early Friday. The Mazda plant in Salamanca, Mexico, is currently under construction and scheduled to open in 2014. It is designed to build the Mazda2 and Mazda3, with a capacity of 140,000 units a year. The Toyota production will add to the plant's capacity.

A redesigned Mazda2 is scheduled to arrive in 2014, which would coincide with the plant's opening. The current Mazda2, launched in 2007, was jointly developed with Ford Motor Co. and shares its platform with the Fiesta.

Ford has since minimized its ownership of Mazda and the two have stopped developing products together. Earlier this year, Mazda pulled out of a production joint venture with Ford in Flat Rock, Mich., that built the Mazda6 sedan. Ford uses Flat Rock to build the Mustang and is adding production of the redesigned 2013 Fusion sedan.

Mazda and Fiat announced in May that they would cooperate on the design of a new generation of the Mazda MX-5 Miata roadster, which will also produce a version for the Alfa Romeo brand.