Toyota Motor Corp., the world's largest automaker, is buying a $50 million stake in electric-car producer Tesla Motors Inc. as the companies seek to offer low-polluting models.

Tesla also will buy a closed Toyota joint-venture plant in California to build its Model S and other vehicles, Tesla chief executive officer Elon Musk said Friday. The companies plan to cooperate in developing electric cars, parts, production systems, and engineering.

The deal may help Toyota compete with Nissan Motor Co. and General Motors Co. in selling electric cars in the United States, where regulations on greenhouse-gas emissions and fuel efficiency are pushing them to offer advanced vehicles. It may also help Toyota's image, battered by recalls, by reviving the New United Motor Manufacturing Inc. plant, known as Nummi, an analyst said.

"This seems like a good deal for both parties, especially Toyota, from being able to avoid the political fallout from shutting Nummi down to being able to offer a new electric vehicle with just a low initial investment cost," said Jeremy Anwyl, chief executive officer at auto-industry researcher in Santa Monica, Calif.

Toyota is the world's biggest seller of hybrid autos, and Palo Alto, Calif.-based Tesla is the only company selling U.S. highway-legal battery-powered cars. The size of Toyota's stake in Tesla hasn't been fixed, Musk said in an interview.

"I've felt an infinite possibility about Tesla's technology," said Akio Toyoda, chief executive officer of Toyota, and grandson of the company's founder. "By partnering with Tesla, my hope is that all Toyota employees will recall that 'venture business' spirit."

Daimler AG, the world's second-biggest maker of luxury vehicles, in May 2009 invested about $50 million in Tesla, which is supplying the company with battery packs for a test fleet of electric Smart minicars.

Daimler reduced its stake in Tesla to about 5 percent in July by selling a portion of the investment to Aabar Investments PJSC, the German automaker's largest shareholder. Tesla told Stuttgart, Germany-based Daimler about the Toyota partnership on May 19, Musk said.

The Toyota-Tesla partnership doesn't impede Daimler's cooperation with the California automaker, said Brigitte Bertram, a Daimler spokeswoman.

The revival of Nummi, for 25 years a joint venture between Toyota and the former General Motors Corp., will create 1,000 jobs, California Gov. Arnold Schwarzenegger said.

Musk declined to say how much his company is spending to purchase Nummi, which was shut down in April. Tesla has hired back about 90 former Nummi workers and expects to add about 50 a month, Musk said.

Nummi, in Fremont, Calif., had 4,700 workers and was the only factory where employees building Toyota vehicles were represented by the United Auto Workers union.

The plant's restart "is welcome news for the state's economy and workers after the closing of this highly productive plant," UAW president Ron Gettelfinger said Friday.