Tesla Motors announced on Thursday that it had an agreement with Panasonic to build a large-scale battery plant in the United States.

Hours after the deal, the company said its losses grew in the second quarter to nearly $62 million, or 50 cents a share, from $30.5 million in the year-ago quarter. But adjusted earnings were 11 cents a share, 7 cents higher than analysts estimated.

The planned factory will produce batteries for Tesla’s all-electric vehicles, as well as modules for the stationary storage market, according to a news release from Tesla.

The company said it estimated that the plant and its associated supplier complex, which it is calling the Gigafactory, would employ 6,500 people by 2020. The company has not yet said where it will be located and is negotiating with several states.