NEW YORK — Tesla Motors said Wednesday that it planned to invest about $2 billion in a large-scale factory to produce cheaper batteries for a mass-market electric car within three years.
The company, which makes all-electric luxury sedans, indicated that it would build the factory in the American Southwest, without specifying where. Nor would it name its partners, whom it said would invest as much as another $3 billion in the factory through 2020.
Tesla said the factory would allow it to develop and cut the costs of its batteries for its vehicles more quickly, in part by producing finished batteries from metal ore instead of from components.
Sales of its Model S sedan, which costs $70,000 and more, have been constrained by a battery shortage, the company has said.
Analysts said Tesla needs more batteries if it is to make its third-generation vehicle, an electric sedan that would be sold for less than $40,000. Panasonic makes batteries for the Model S.
Jessica Caldwell, senior analyst at Edmunds.com, said that for all-electric cars to be embraced by consumers, “the price needs to come down, and batteries are a big part of that.”
By building its own factory, Tesla would have more control over the supply and cost of its batteries.
“With this facility, we feel highly confident of being able to create a compelling and affordable electric car in approximately three years,” Elon Musk, Tesla’s chief executive, and Deepak Ahuja, its chief financial officer, wrote in a report last week.
The automaker expects to reduce the per-kilowatt cost of its battery packs by more than 30 percent by the end of the first year of volume production for its third-generation electric vehicle. At full production, the factory, known as the Gigafactory, would produce about 500,000 lithium-ion batteries annually by 2020, more than suppliers worldwide produced last year.
Nevada, Arizona, New Mexico, and Texas are among the states Tesla said it was considering for the factory. The finished batteries would be shipped to Tesla’s assembly plant in Fremont, Calif.
The factory will employ as many as 6,500 workers, the company said.
Some analysts said they were surprised that Tesla announced the project without having key details, such as partnerships and a site, in place.
‘‘I wasn’t expecting a two-step process, with bidding left,’’ said Efraim Levy, senior automotive equity analyst at S&P Capital IQ.
The potential uses for mass-market Tesla vehicles go far beyond transportation and could help redefine the relationship between consumers and their cars.
Government officials and entrepreneurs have for years envisioned a future in which owners can use electric vehicles as power sources for their homes or sell electricity to utilities in times of high demand, which could help stabilize the power grid.
Musk is also chairman of the residential solar power company SolarCity, which is already moving in that direction, using Tesla battery packs for solar customers to store power from their rooftop arrays for use at night, as well as a system for businesses to help them reduce their need for power from the grid.