What happened

Shares of Tesla (TSLA -2.03%) surged higher this week, rising as much as 20.9%, according to data from S&P Global Market Intelligence. As of this writing on Friday morning, the stock is up a total of 20% this week.

The growth stock's gain was fueled by the continued momentum of its shares since the company reported strong third-quarter earnings earlier this month, a big order of Tesla vehicles from Hertz, and a number of analyst upgrades for the electric-car maker's stock.

Tesla vehicle production at its factory in California.

Tesla's factory in California. Image source: The Motley Fool.

So what

Capturing the stock's momentum for the full month, Tesla shares are up more than 40% since the beginning of October. Much of this gain has come since the company reported third-quarter revenue and earnings per share that exceeded analyst expectations on Oct. 20.

Adding to the stock's momentum, Hertz announced it would order 100,000 Tesla vehicles by the end of next year. A few days after this announcement, Uber said it would use 50,000 of those vehicles as rentals for its drivers beginning Monday. 

Analysts have been cheering the company's performance, with many of them increasing their 12-month price targets for the stock. Perhaps the most bullish call for Tesla shares came on Wednesday afternoon, when Piper Sandler analyst Alexander Potter said competition appears to be failing to curb Tesla's dominance. He gave shares a 12-month price target of $1,300.

Now what

This has been a huge year for Tesla as the company's revenue has soared and its operating margin has expanded significantly. Its third-quarter revenue increased 57% year over year, and operating margin was 14.6% -- up 534 basis points year over year. This helped net income increase 389% year over year to $1.6 billion.

Looking ahead, Tesla is confident that its long-term profitability will improve further. "We expect our operating margin will continue to grow over time," management explained in Tesla's third-quarter shareholder letter, "continuing to reach industry-leading levels with capacity expansion and localization plans underway."