ASML (ASML 2.04%) and TSMC (TSM 1.26%) are two mutually dependent bellwethers of the semiconductor sector. ASML is the world's largest manufacturer of lithography systems, which are used to etch circuit patterns onto silicon wafers. It's also the only manufacturer of high-end extreme ultraviolet (EUV) lithography systems, which are required to produce the world's smallest chips.

ASML's largest single customer is TSMC, the world's largest and most advanced contract chipmaker. TSMC uses ASML's EUV and older deep ultraviolet (DUV) systems to manufacture chips for fabless chipmakers, like Apple, Nvidia (NVDA 6.18%), Qualcomm, and AMD.

A silicon wafer.

Image source: Getty Images.

ASML is based in the Netherlands, and TSMC is headquartered in Taiwan, but both companies have been affected by the tech war between the U.S. and China. ASML has been barred from exporting its EUV systems to China since 2019, and a new round of export curbs will prevent it from shipping its higher-end DUV systems to China next year. TSMC was forced to stop making chips for the Chinese tech giant Huawei in 2020, and new U.S. sanctions will prevent it from meaningfully upgrading its fabs in China.

Both companies also struggled with the semiconductor market's slowdown over the past year as sales of PCs declined in a post-pandemic market, fewer consumers bought 5G smartphones, and the macro headwinds disrupted multiple industries. Yet, over the past 12 months, ASML's stock rallied over 30% and TSMC's stock rose more than 40%. Investors seem to be buying both stocks in anticipation of a cyclical recovery, but which is the better buy?

ASML anticipates flat sales growth in 2024

ASML's revenue rose 33% in 2021 as the global chip shortage drove the major foundries to install more EUV and DUV systems. But in 2022, its revenue only grew 14% as the chipmakers produced too many chips for a cooling market. The macro headwinds and export curbs against China exacerbated that pressure.

Analysts expect ASML's revenue to rise 28% this year as its top customers -- TSMC, Samsung, and Intel (INTC -9.20%) -- continue to expand their EUV capabilities. But it's also experiencing a surge in DUV orders from Chinese chipmakers, which have been stocking up on those older systems before the latest export curbs kick in on Jan. 1. Analysts expect its earnings per share (EPS) to grow 38%.

Those robust growth rates suggest the semiconductor market is bottoming out, but ASML recently told investors to brace for nearly flat sales growth in 2024. It expects 2024 to be a "transition year" as its sales to China (14% of its sales in 2022) decline and its top customers remain "uncertain" regarding the sector's near-term recovery.

On the bright side, ASML told investors it would likely generate "significant growth" in 2025 as it laps those challenges, the macro environment improves, and it rolls out its latest high-NA EUV systems for sub-2nm chips. Over the long term, ASML still expects to generate €44 billion ($46 billion) to €60 billion ($63 billion) in revenue by 2030, which would represent a compound annual growth rate (CAGR) of 7%-12% from 2023.

TSMC expects its growth to accelerate in 2023

TSMC's revenue rose 25% in USD terms in 2021 and grew another 34% in 2022. But for 2023, it expects its revenue to drop 9% as the PC and smartphone markets cool off.

That slowdown is disappointing, but TSMC's revenue actually grew sequentially for the first time in four quarters during the third quarter of 2023. It expects that quarter-over-quarter recovery to continue in the fourth quarter, which strongly implies the semiconductor market has finally reached its cyclical trough. The surging demand for high-performance computing (HPC) chips -- led by Nvidia in the artificial intelligence (AI) market -- should also offset its slower production of PC and smartphone chips.

TSMC expects its margins to be squeezed over the next few quarters as it ramps up its production of 3nm chips and prepares to roll out its 2nm chips in 2025. Yet, that higher spending isn't surprising since it should help TSMC stay comfortably ahead of Samsung and Intel in the "process race" to produce smaller, denser chips.

For 2024, analysts expect TSMC's revenue and earnings per American depositary share (ADS) to grow 17% and 21%, respectively, as the semiconductor market recovers and the macro environment improves. The latest export curbs and tech restrictions shouldn't affect TSMC as much as ASML since it will still be allowed to manufacture its lower-end chips in China. But if you believe trade and military tensions will flare up between China and Taiwan again, ASML might be the better-diversified bet because it's more geographically diversified.

The winner: TSMC

ASML trades at 26 times forward earnings, while TSMC has a much lower forward multiple of 16. Therefore, I believe TSMC's lower valuation and stronger near-term outlook make it a better buy than ASML right now -- even though both stocks are still sound long-term plays on the secular growth of the semiconductor market.