Tesla sold 367,500 cars in 2019, a new record for the company, according to figures published to its website early on Friday morning. While that’s on the low end of the estimate of 360,000 to 400,000 vehicles delivered that the company offered up at the beginning of 2019, the Silicon Valley automaker still sold more cars in 2019 than it did in the previous two years combined, all thanks to the popularity of the Model 3 sedan.

The new delivery record helps cap what was something of a banner year for Tesla. The company unveiled two new prototypes, with the Model Y compact SUV breaking cover in March and the stark, polarizing, and meme-worthy Cybertruck being revealed in November. Tesla also both broke ground on its officially opened a factory in China, setting the automaker up to make and sell Model 3s locally in the country moving forward, which will help the company duck transport costs and import taxes.

This was all despite a rough start to 2019. Tesla began the year with a $702 million loss in the first quarter, its fourth-worst quarterly loss since becoming a publicly traded company in 2010. Deliveries of the Model 3 dropped dramatically from the end of 2018, which CEO Elon Musk attributed to the fact that Tesla was in the process of shifting focus to two potentially huge new markets for the car in Europe and China. Musk said early in the year that spinning up deliveries of the high-volume Model 3 in those markets was the “most difficult logistics problem [he’d] ever seen.”

Tesla started 2019 in rough shape but finished the year strong

The company spent months fighting back the narrative that demand for its cars was falling, and, as a result, Tesla’s stock price steadily dropped throughout the first half of the year to below $180 per share — its lowest point in three years. But the company rebounded in a big way, finishing the year with its stock price at an all-time high, entering 2020 trading at well over $400 per share.

Tesla recovered in a big way in the fourth quarter of 2019, delivering 92,550 Model 3s alone, and 112,000 vehicles overall (more than it delivered in all of 2017). As is practically tradition at this point, the company made a big push at the end of the quarter to get as many cars out the door as possible to set the record, with Musk even appearing at the company’s main factory in California on New Year’s Eve to “help with deliveries.”

This was all before Tesla started delivering locally made Model 3s in China, too, which represents a great opportunity for the company to increase its sales in 2020. China is the largest market for electric vehicles in the world, and despite cooling off this year, it could help Tesla keep up the pace of growth that Musk is always hungry for. The company even cut prices on the Chinese-made Model 3 on Friday ahead of the first batch of deliveries (beyond the ones to employees). This could help boost sales in the country, though it could come at the expense of profit depending on how many locally made Model 3s Tesla winds up selling in China.

Tesla’s likely to continue facing questions about profitability even with the new sales record. The company has only turned in a handful of profitable quarters in its decade as a publicly traded company. The most recent was the third quarter of 2019, though that was due in large part to sales of regulatory credits, which the company can recognize as revenue whenever it likes. Musk has said a number of times over the last few years that he hopes to make Tesla a consistently profitable company. But much like fellow tycoon Jeff Bezos did with Amazon, he’s also proved willing to sacrifice profitability in the name of growth.