Shares of Taiwan Semiconductor Manufacturing (TSM 1.26%), popularly known as TSMC, have underperformed the broader semiconductor sector in 2023 thanks to the company's tepid growth. But it looks like the foundry giant could finish the year on a solid note following its latest quarterly report.

TSMC stock jumped after the company released its third-quarter results on Oct. 19. The semiconductor bellwether's revenue and earnings comfortably exceeded Wall Street's expectations, and its guidance suggests that its recent struggles may finally be coming to an end. This could bode well for TSMC investors who have seen the stock gain only 15% so far this year versus the PHLX Semiconductor Sector index's gain of 27%.

With the stock currently trading at an attractive valuation, it may be a good idea for investors to consider buying TSMC as it's set to capitalize on the growing demand for artificial intelligence (AI) chips. Let's take a closer look at the factors driving an improvement in TSMC's fortunes.

TSMC's turnaround is almost here

TSMC's Q3 revenue fell 15% year over year to $17.3 billion, while earnings were down 28% to $1.29 per share. However, there was a nice sequential jump of 10% in revenue and 13% in earnings, pointing to an improvement in the semiconductor market.

The company has been bogged down by weak smartphone and personal computer (PC) demand in 2023. That's not surprising as the company gets 39% of its revenue from selling smartphone chips. Market research firm IDC expects global smartphone volumes to drop 4.7% in 2023 to hit their lowest levels in a decade. But there was a 33% sequential increase in TSMC's smartphone revenue last quarter.

The company's smartphone revenue could improve further as IDC expects the market to recover in 2024 with smartphone shipment volumes expected to increase 4.5%. This explains why TSMC is guiding for $19.2 billion in revenue in the current quarter at the midpoint of its guidance range. That would shrink its year-over-year revenue decline to about 4%. If TSMC does hit the midpoint of its Q4 revenue guidance, it will finish the year with a top line of almost $69 billion, a drop of 9% from 2022 levels.

However, analysts are anticipating a major turnaround in the company's fortunes in 2024.

TSM Revenue Estimates for Next Fiscal Year Chart

Data by YCharts.

The chart above also tells us that TSMC is likely to sustain impressive growth in 2025. Of course, a recovery in smartphones is going to play an important role in this turnaround, but at the same time, investors should note that one of the key reasons why its results are set to improve is because of the growing demand for its advanced chips manufactured using the 5-nanometer (nm) process.

AI could be a big growth driver for TSMC

TSMC's 5nm chips are playing a critical role in powering AI data centers. Nvidia, for instance, has been lapping up TSMC's 5nm chips to design its AI graphics processing units (GPUs). As a result, TSMC's revenue from 5nm chips stood out last quarter with 14% year-over-year growth to $6.4 billion. The technology made up 37% of Q3 revenue, up from 28% in the year-ago period. What's more, these chips could drive stronger revenue growth for TSMC as both Nvidia and Advanced Micro Devices are now making AI chips on the 5nm platform.

Nvidia's flagship H100 GPU is based on TSMC's 5nm platform, and demand for the Nvidia chips is so strong they command a waiting period of six months. The Financial Times reported that Nvidia is reportedly aiming to triple the output of H100 GPUs in 2024 to 1.5 million units at least. The company may even raise its output to 2 million.

In light of that rising output, TSMC is reportedly going to increase its packaging capacity of advanced chips from an estimated 12,000 wafers a month to a range of 25,000 to 30,000 wafers. The Taiwan-based company may also be boosting its equipment orders by 30% to achieve this massive capacity jump. Meanwhile, AMD could turn out to be another key customer for TSMC's 5nm chips since the company's upcoming MI300X data center accelerators will be powered by a mix of 5nm and 6nm chips.

It's worth noting that AMD is witnessing robust customer interest in these chips. CEO Lisa Su said on the company's August earnings call:

AI cluster engagements grew by more than seven times sequentially as multiple customers initiated or expanded programs supporting future deployments of Instinct MI250 and MI300 hardware and software at scale.

The company is aiming high in the AI chip market. It's going after Nvidia in this space with its upcoming processors, which feature powerful specs. Not surprisingly, AMD could become a key customer for TSMC's advanced chips starting next year. All of this bodes well for TSMC's 5nm chip platform, which is its largest source of revenue right now.

Another compelling reason to buy the stock

TSMC stock is currently trading at 14 times trailing earnings, which represents a discount to its five-year average multiple of 23. The Nasdaq-100 index, on the other hand, sports an average price-to-earnings multiple of 29. That steep discount makes TSMC stock look like quite the steal right now.

Analysts also believe tailwinds from opportunities like AI will drive strong earnings growth going forward:

TSM EPS Estimates for Current Fiscal Year Chart

Data by YCharts.

Assuming TSMC does hit $7.72 per share in earnings in 2025 while trading at its five-year average forward earnings multiple of 21, its stock price would reach $162. That would be a 88% jump from current levels, suggesting that investors who buy this AI stock right now and take advantage of its attractive valuation could see impressive gains.