Tesla said Monday that it met a closely watched goal for production, however it fell short on deliveries during the second quarter.

The electric car maker's shares initially traded higher following the news, but gradually erased gains to turn lower in midday trading.

Tesla said it produced 53,339 vehicles during the second quarter, an increase of 55 percent from the prior period. The production numbers came out to 28,578 Model 3 sedans — triple from the previous quarter — and 24,761 Model S and Model X cars combined. It called it "the most productive quarter in Tesla history by far."

Deliveries, meanwhile, totaled 40,740 vehicles — falling short of what some on Wall Street had expected.

For the second quarter, Tesla delivered 18,440 Model 3 cars. The consensus, according to Goldman Sachs analyst David Tamberrino, was for the company to deliver as many as 28,000 Model 3 vehicles. The company also delivered 10,930 Model S and 11,370 Model X cars.

While the second-quarter delivery numbers will get a fair amount of attention from analysts and investors, the story driving Tesla shares higher is Model 3 production, and whether the company can sustain a higher output rate for its newest model and power the company to become cash flow positive in the second half of 2018.