You can't go five minutes without hearing about Nvidia these days. The computer chip giant recently became the largest company in the world by market capitalization and today is valued at over $3.34 trillion. Investors are betting that the huge capital spending on artificial intelligence (AI) will continue, with Nvidia maintaining its dominant market position.

But what companies power Nvidia? There is one that rises above all the rest, and it is the backbone of most advanced semiconductor manufacturing around the globe. Enter Taiwan Semiconductor Manufacturing (TSM 0.23%), a company powering Nvidia and the AI revolution.

Is the stock a buy? Let's take a closer look and find out.

Taiwan Semiconductor: The backbone for modern computing

Taiwan Semiconductor (TSMC for short) has risen above the pack in chipmaking due to its innovative foundry model. What this means is TSMC does not sell the chips it makes directly to customers -- Intel's old business model -- but aggregates orders from computer chip designers. This allows it to focus solely on manufacturing expertise and keep a lead in the most-advanced semiconductor manufacturing in the world.

It has few if any competitors such as Intel, Samsung, and homegrown Chinese players. Customers include Apple, Alphabet, Amazon, and the aforementioned Nvidia. With the rise of computing demand for new AI tools, companies have had to purchase chips from players like Nvidia or design their own. Almost all of them outsource this production to TSMC.

With minimal competition and huge switching costs, the company has a huge lock-in with customers and a ton of pricing power that allow it to generate outsized profits. In the past 1 years, operating income has grown by close to 300% and hit $30 billion over the past 12 months. It generates just over $70 billion in revenue and saw 30% revenue growth in May as more orders come in for the boom in AI capital spending.

Investors bet on AI and geographical diversification

TSMC stock is up 439% in the last five years and has hit multiple all-time highs in 2024. Investors are betting that the AI revolution will continue to drive growth for the company over the next few years. Yet, anyone looking to buy the stock today should wonder if the market is getting a bit overexcited with AI companies right now.

Some might see parallels to the dot-com bubble with AI stocks. Even though the internet turned into one of the most important technologies ever, that did not prevent overpriced stocks from falling 90% when the bubble burst. Given its diversification across the entire semiconductor market, it is hard to see a 90% drawdown occurring for TSMC, but the risk of an AI bubble persists nonetheless.

Another potential tailwind for TSMC is geographical diversification. The company has its manufacturing centered on its home turf, which faces an increasing risk of Chinese aggression. Obviously, this would be bad for shareholders.

To alleviate this risk, TSMC is working with countries like the United States to build factories outside of Taiwan. It was recently awarded $6.6 billion from the U.S. government and is building factories worth tens of billions of dollars in the country. This will help bring down the China invasion risk and spur growth over the next decade.

TSM PE Ratio Chart

TSM PE Ratio data by YCharts.

But is the stock cheap?

Less than two years ago, TSMC traded at a price-to-earnings (P/E) ratio just above 10. Now, the ratio is about to breach 35. In hindsight, TSMC was clearly undervalued at a P/E in the low teens.

It is hard to make the same argument with the stock climbing now to all-time highs. This is not a hypergrowth business that can instantly triple its revenue. Yes, it is currently growing revenue due to AI spending, but that also comes with the bubble risk of new technologies. Let's not forget the China risk, either.

The S&P 500 trades at a P/E of about 28. TSMC is well above this level, and it's not like the market is cheap either. Taking all these factors into consideration, TSMC stock does not look like a good stock to buy at these prices even though it is the backbone of the AI revolution.