Tesla saw its revenue in the US dropping by 39 percent during the third quarter of the year for the first time in over two years, but surging demand in China and other regions covered most of the loss.

Citing a regulatory filing showing Tesla’s break down of sales by geography, Reuters reports that the company’s revenue from US sales during the third quarter fell to $3.13 billion from $5.13 billion a year earlier.

However, sales in China increased by 64 percent to $669 million, while sales in the rest of world increased by more than a billion dollars to $1.83 billion. Overall, Tesla’s total revenue results were down by 8 percent to $6.3 billion, narrowly missing analysts’ average estimate of $6.33 billion.

Also Read: Tesla Says Model Y Will Launch Slightly Ahead Of Schedule

“Musk & Co. are laser-focused on Europe and China for growth, while domestically, core demand is fading relative to other regions,” said Wedbush analyst Dan Ives, adding that further growth in the US market will become more challenging from now on.

Nevertheless, the big surprise for investors was the announcement of a $342 million quarterly profit, which sent Tesla’s shares up by 20 percent. The good news also included the announcement of Tesla’s Gigafactory in Shanghai being ahead of schedule, as does the upcoming Model Y.

Elon Musk is under pressure to make Tesla sustainably profitable while spending big money on the company’s Chinese Gigafactory and upcoming models like the Model Y and the Semi truck. Tesla is planning to deliver between 360,000 to 400,000 vehicles in 2019, saying that it remains “highly confident in exceeding 360,000 deliveries this year.”