Making electric vehicles mainstream, selling them for a profit, and becoming the richest man in the world in the process -- Tesla (TSLA 3.49%) CEO Elon Musk has done it all. And by generating profits for two straight years, Tesla has proved its naysayers wrong. The company's stock has risen some 1,400% over the past three years.

The big question now is whether the stock is still a buy. Again, the investors are sharply divided. Let's take a closer look at the stock to see whether it's Tesla bulls or bears who are likely right about the stock.

The growth of electric vehicles

Had there been any doubts earlier, the growth in electric vehicles (EVs) in the past couple of years made it clear that the future of transportation is electric. Electric car sales, including plug-ins, more than doubled in 2021 to 6.6 million units. That was nearly 9% of the global car sales for the year. At 3.4 million units, the EV sales in China alone accounted for more than half of the global sales. Around 2.3 million EVs were sold in the Europe and over half a million in the U.S. 

Tesla's Model Y.

Image source: Tesla.

Tesla sold the most EVs globally in 2021, with 936,000. The company operates in all three major markets for EVs, with 352,000 cars sold in the U.S., 321,000 in China, and 170,000 in Europe last year. Presence in all the major markets not only diversifies Tesla's revenue, but also allows it to grow faster. Volkswagen followed Tesla, selling 763,000 electric vehicles in 2021.

The demand for EVs right now exceeds the supply. This could well be the case over the next few years until the companies ramp up their EV production. That bodes well for Tesla, which is not only selling the most EVs right now but can continue doing so, considering its focus on expansion. Tesla's factories in Texas and Berlin are at the equipment test stage, and the company expects to start vehicle deliveries from both factories soon.

Furthermore, the company is doing exceptionally well on the margins front. Tesla reported an operating margin of 14.7% for the fourth quarter.

Chart showing Tesla's operating margin beating several other major automakers in 2021.

TSLA Operating Margin (Quarterly) data by YCharts

The EV maker generated industry-leading margins in the third quarter as well.

Tesla stock trades at a premium

Tesla's leadership position in EVs gets reflected in the premium valuation of its stock. Tesla stock trades at a significantly higher price-to-earnings (P/E) ratio compared to legacy automakers.

Chart showing Tesla's PE and PEG ratios beating several major automakers in January 2022.

TSLA PE Ratio data by YCharts

What's more, Tesla stock is trading at a significant premium compared to even the top technology stocks.

Chart showing Tesla's PE and PEG ratios beating several major tech stocks in January 2022.

TSLA PE Ratio (Forward 1y) data by YCharts

Tesla's P/E to growth (PEG) ratio, which divides its P/E ratio by its expected earnings growth, is less than 1. All other things remaining equal, a lower PEG ratio is better for a stock, and a ratio below 1 indicates that a stock likely isn't overvalued. Tesla's lower PEG ratio reflects its high earnings growth.

Tesla faces stiff competition

Tesla had a huge edge over its competition so far. When it started selling EVs, no other manufacturer was doing so seriously. But that isn't the case anymore. With so many new EV companies as well as traditional car companies pouring billions of dollars into electrification, Tesla faces some stiff competition. Volkswagen intends to make half of its sales electric by 2030. Ford aims to make 40% to 50% of its sales electric by 2030. Then there are new EV companies, such as Lucid and Rivian, trying to capture a share of the EV pie.

In China, apart from global automakers, Tesla also faces competition from domestic EV companies such as BYD, Nio, and XPeng.

Is the EV pioneer's stock a buy?

Tesla stock's premium valuation is in large part due to its higher revenue growth and higher margins compared to other automakers. However, with rising competition, the higher growth and margins may not last very long.

Yet, Tesla can enjoy the high growth and margins at least for the next couple of years, till its competitors catch up. That would be enough to further solidify Tesla's position in the EV market. This growth potential already gets reflected in the stock's valuation.

However, beyond that, Tesla needs to show that it can sustain the high growth at such high margins. Otherwise, the company will have to look at profitability-enhancing sources -- maybe full self-driving, robo-taxis, or car insurance based on drivers' risk profiles generated using informatics -- to justify its valuation.

So, Tesla could be an EV company, with its current offerings, which does not indicate much upside potential for its stock. Or it can continue disrupting the EV space to create still higher value for its shareholders. The latter case is unproven yet, and it is important to note that buying Tesla stock believing that the company will be successful in autonomous driving, or other such endeavor, entails risk. Of course, Tesla can succeed there too, but if you are risk averse, you may not want to jump in right now.