Elon Musk, co-founder and chief executive officer of Tesla Inc., speaks during an unveiling event for the Tesla Model Y crossover electric vehicle in Hawthorne, California, U.S., on Friday, March 15, 2019.Patrick T. Fallon | Bloomberg | Getty ImagesTesla delivered a strong third-quarter earnings report after the bell on Wednesday, posting a surprise profit and telling shareholders it is ahead of schedule with a new factory in Shanghai. Shares spiked as much as 17% after hours, putting them at their highest price since February.Here’s what the results were versus analysts’ expectations:Adjusted earnings per share of $1.86 vs. expected losses of 42 cents per shareRevenue of $6.3 billion, vs. expected $6.33 billion, according to Refinitiv consensus estimatesThe electric car maker gave investors plenty to look forward to next year. It released a glossy 28-page investor update filled with photos from its new factory in Shanghai where Tesla said it’s already begun trial production runs.The company also said it was ahead of schedule on its long-awaited Model Y crossover, which it now expects to launch by next summer. At the same time, Tesla says it is planning to make a limited run of its Tesla Semi truck next year, and hopes to soon announce the location of its European Gigafactory, where it aims to begin making electric vehicles in 2021.A photograph of the new Tesla paint shop in the Shanghai Gigafactory provided by the company in its Q3 2019 earnings release.TeslaIn its Q3 2019 Update, Tesla said:”Gigafactory Shanghai was built in 10 months and is ready for production, while it was ~65% less expensive (capex per unit of capacity) to build than our Model 3 production system in the US.”A photo of general assembly in Tesla’s new Shanghai Gigafactory, provided by the company with its Q3 2019 earnings release.TeslaLast quarter, Tesla shares dropped after the company reported losses of $1.12 per share and $6.35 billion in revenue. At this time last year, Tesla reported a “historic” third quarter with revenue of $6.82 billion and earnings per share of $2.90.Margins will be in sharp focus on today’s earnings call, in part, because Tesla launched its own auto insurance offering during Q3, and new Autopilot software upgrades which may enable the company to recognize deferred revenues. The company has been selling more, lower-priced Model 3 vehicles in 2019, and fewer higher-priced Model S and Model X’s.The company said in its Q3 report: “Despite reductions in the average selling price (ASP) of Model 3 as global mix stabilizes, our gross margins have strengthened.”In Q3, Tesla released over-the-air software updates, including a controversial Smart Summon feature, that lets some Tesla drivers use an app to remotely call and control their cars. The cars can, in some situations, come pick them up from a short distance away, navigating a parking lot without any driver behind the wheel to do so.Today’s third-quarter earnings report is the first for Tesla since the departure of co-founder and former CTO JB Straubel, and since the company completed the acquisition of two companies: A computer vision startup called DeepScale, and a battery manufacturing firm called Hibar Systems.Follow @CNBCtech on Twitter for the latest tech industry news.