Tesla Motors will partner with Panasonic Corp. to create the $5 billion "gigafactory" battery plant that the company has said will bring down the cost of its popular but expensive electric cars.

Panasonic could invest as much as $1 billion in the massive facility, which Tesla plans to build at an undetermined location in either Arizona, New Mexico, Texas or Nevada. (Although some analysts have speculated that California is also a possible future home for the gigafactory, Tesla chief executive Elon Musk has characterized this as "a long shot.")

Tesla already uses Panasonic's lithium-ion battery cells, produced in Japan, for its California-made electric automobiles. Under the terms of the new partnership, jointly announced in Palo Alto and Osaka, Japan, Tesla will supply the factory and Panasonic will build the cells at the new facility.

Tesla will use the increased production of cells, and resulting lowering of per-battery cost, to drive production of a lower-priced Model 3 "mass market" electric car.  Tesla has said it could market such a car at under $40,000, or less than half the cost of its currently-available Model S. The company has also said it will begin selling a Model X crossover vehicle next year.

Tesla said the factory will employ about 6,500 people by 2020. The company already has factories in several Northern California locations, but has indicated its gigafactory is likelier to be built elsewhere.

Stock in the publicly traded electric car company, which will announce quarterly earnings after the market closes today, was down slightly in mid-morning trading.

Twitter: @misterfleming