A Tesla dealership in New York, April 29, 2016. The carmaker said Wednesday, May 18, it plans to raise $2 billion in a stock offering. Photo: REUTERS/Lucas Jackson/File Photo

Tesla Motors has answered a question that has been floating around for months: How is it going to raise much-needed capital to hit its goals over the next few years?

On Wednesday, the Palo Alto, California, maker of the Model S electric luxury car and Model X luxury utility vehicle answered that question by announcing it would begin selling stock or securitized debt in an effort to raise at least $1.4 billion to be used for “general corporate purposes.” The sale would be one of the biggest U.S. equity transactions of the year so far.

In addition to the company's stock sale, CEO Elon Musk is selling a portion of his shares, which could raise another $600 million, according to the prospectus.

The company said it would offer 6.8 million shares while a group of five investment banks, including Morgan Stanley and Goldman Sachs, acting as lead book runners for the stock offering, would offer an additional 2.77 million shares. Deutsche Bank, Citibank and Bank of America Merrill Lynch will also participate.

The announcement came just hours before Goldman Sachs issued a research note upgrading the company’s stock to “buy” based on improved U.S. macroeconomic conditions and a higher-than-expected volume of preorders for the $35,000 Model 3 sedan, due out in late 2017.

“We think diminished concerns about a recession provide a bit more downside protection than in February, as does the near 400k in reservations, which validate the long-term demand picture in our view,” the note said. Goldman set a six-month target price of $250 per share, up from around $211 on Wednesday.

In its first-quarter letter to shareholders, Tesla said it expected its level of capital expenditures for the year to increase from $1.5 billion to about $1.75 billion as it moved forward its target of building 500,000 cars to 2018 instead of 2020. The move came after the company received nearly 400,000 Model 3 preorders.

For months analysts have speculated that Tesla would either borrow more money or look to the markets for more capital. The company ended March with $1.44 billion in cash and equivalents and $3.19 billion in short-term liabilities, meaning payments that come due within 12 months.

Tesla’s share price rose following the release of the Goldman note early Wednesday and ended the regular trading session up 3.18 percent at $211.17. The price fell nearly 2 percent in after-hours trading.