The artificial intelligence revolution is coming, and investors are rushing to position themselves for the future. Nvidia (NVDA -3.89%) has been the early winner; its dominance in high-powered GPUs and data center chips fueled the stock's 175% rise since January.

But it might not be the best AI stock for your money after its big move. Instead, consider Taiwan Semiconductor (TSM -1.75%), the world's leading chip manufacturer. While it does carry some geopolitical risks, its strong business and compelling valuation make it a potential winner worth considering for your portfolio.

Here is what you need to know.

Here's the pitch

There are a handful of companies that design and sell semiconductor chips, but many of these companies don't make them. Instead, they outsource production to contract manufacturers called foundries. Taiwan is the world's hub for foundries. The country is behind roughly 60% of the world's foundry revenue, led by Taiwan Semiconductor, which builds for Apple, Qualcomm, and, yes, Nvidia.

Taiwan Semiconductor is the dominant foundry in Taiwan, building an estimated 50% of the world's semiconductors and an even higher percentage of the most advanced chips thanks to the company's state-of-the-art technology and facilities. The company does more than $75 billion in annual revenue and is very profitable, turning that into $16 billion in free cash flow (about a 21% conversion rate).

Nvidia gets so much attention because it's today's leader in the types of chips powering AI applications. But there is at least a solid chance that some of its customers will eventually design their own chips to cut costs and reduce their dependency on Nvidia's products. If that happens, it could very easily be Taiwan Semiconductor that builds them. Whoever Taiwan Semiconductor's building chips for, its foundry leadership arguably makes it as much a pick-and-shovel AI investment as Nvidia.

A bargain sitting in plain sight

Nvidia shocked Wall Street when it obliterated future growth expectations with a massive guide for revenue growth in Q2. The resulting growth revisions have priced the stock at a forward price-to-earnings ratio (P/E) of 52, even after the stock's tremendous run.

Meanwhile, Taiwan Semiconductor is priced at a P/E of 20, even though Nvidia's growth will trickle through the company that builds all its chips. The stock's even cheaper on a trailing basis (a P/E of 15), but earnings are expected to decline year over year in 2023. Analysts expect Taiwan Semiconductor to grow earnings by roughly 5% annually over the next several years. However, those figures could get revised higher based on the surge Nvidia has begun to see.

TSM PE Ratio (Forward) Chart

TSM PE Ratio (Forward) data by YCharts

Taiwan Semiconductor has the market share and the strong margins to command a premium valuation if the growth is there. If AI is the most significant technological leap since the internet, it's hard to see how that wouldn't reflect in Taiwan Semiconductor over the coming years. The stock could be a better value than it currently looks on the surface.

Is Taiwan Semiconductor worth the geopolitical risks?

The one potential hangup with Taiwan Semiconductor is the geopolitical crosshairs it finds itself in today. Taiwan and China have a tense relationship, and a hypothetical invasion of Taiwan could impact Taiwan Semiconductor's share price. Warren Buffett recently discussed that risk after Berkshire Hathaway bought shares of Taiwan Semiconductor, then sold them rather quickly.

Whether geopolitical risks are enough to keep you out of the stock is a personal choice. However, assuming the Taiwan and China relations don't boil over, Taiwan Semiconductor is an attractively valued AI winner with the pick-and-shovel exposure to be an excellent long-term investment, regardless of who the long-term leading chip designers are.