Nvidia (NVDA 5.78%) and ASML (ASML 2.15%) are two of the world's most important semiconductor companies. Nvidia is the world's largest producer of discrete graphics processing units (GPUs) for video games, graphical applications, and artificial intelligence (AI) tasks. ASML is the top producer of lithography systems used to etch circuit patterns onto silicon wafers and the only supplier of top-tier extreme ultraviolet (EUV) lithography systems required to produce the world's smallest and densest chips.

Nvidia is a fabless chipmaker, outsourcing its production to third-party contract chipmakers like Taiwan Semiconductor Manufacturing (TSM 0.92%) (TSMC) and Samsung. Those leading foundries use ASML's lithography systems to manufacture their chips, so we can safely say that Nvidia and other fabless chipmakers couldn't survive without the company.

A person plays a PC game.

Image source: Getty Images.

I compared these two companies last April and concluded that ASML's broader diversification, unrivaled pricing power, and long-term growth potential made it a better buy than Nvidia. But since I made that call, ASML's stock only advanced about 20% as Nvidia's nearly doubled. Let's see why Nvidia outperformed ASML by such a wide margin -- and whether it will remain the better play in the semiconductor sector for the foreseeable future.

Nvidia's cyclical downturn might have already ended

Nvidia's revenue soared 53% in fiscal 2021 (which ended in Jan. 2021) and grew 61% in fiscal 2022. Its adjusted earnings per share (EPS) surged 73% in fiscal 2021 and climbed another 78% in fiscal 2022.

Three catalysts drove that massive growth spurt. First, the pandemic sparked a buying frenzy for new PCs for online classes, remote work, and high-end gaming. Second, the soaring usage of cloud-based services prompted many data centers to upgrade their servers and install more high-end GPUs to process AI tasks. Lastly, its acquisition of the data center networking company Mellanox in April 2020 inorganically boosted its sales.

But in fiscal 2023, Nvidia's revenue stayed nearly flat as its adjusted EPS dropped 25%. That slowdown was largely caused by declining sales of new PCs in a post-pandemic market, macro headwinds for data centers, and declining cryptocurrency prices, prompting many miners to flood the secondhand market with used GPUs. U.S. regulators also abruptly barred Nvidia from selling its top-tier data center GPUs to Chinese customers.

Faced with those challenges, many analysts expected Nvidia to suffer a long and painful cyclical slowdown. But after enduring three consecutive quarters of year-over-year revenue declines, Nvidia expects its revenue to surge 64% year over year in the second quarter of fiscal 2024 -- blowing past the consensus forecast for 6% growth -- as the expansion of the red-hot generative AI market sparks a buying frenzy in its high-end data center GPUs. It also expects its gaming business to recover.

After hastily revising their forecasts, analysts expect Nvidia's revenue and adjusted EPS to rise 48% and 115%, respectively, this year. Nvidia's stock isn't cheap at 84 times forward earnings, but it might deserve that premium valuation.

ASML continues to generate stable double-digit growth

ASML's revenues and profits ebb and flow with the broader semiconductor sector. In 2020, its revenue and EPS grew 18% and 38%, respectively, as the global chip shortage drove foundries to rapidly expand their manufacturing capabilities. In 2021, its revenue and earnings surged 33% and 69%, respectively, as TSMC, Samsung, and Intel (INTC -9.51%) installed more EUV systems to gain an edge in the ongoing "process race" to produce smaller, denser chips.

However, that acceleration abruptly ended in 2022 as sales of new PCs declined, the smartphone market stalled out after the 5G upgrade cycle, and macro headwinds forced the top foundries to rein in their ambitious expansion plans. New restrictions on sales of lithography systems to Chinese chipmakers further throttled ASML's sales.

As a result, its revenue only rose 14% in 2022 as its EPS dipped 2%. But like Nvidia, ASML expects its cyclical slowdown to be brief. It expects its revenue to rise at least 25% with expanding margins this year as TSMC, Samsung, and Intel all ramp up their purchases of new EUV systems in preparation for the semiconductor sector's recovery.

ASML also reiterated its long-term target of generating 44 billion euros ($47.2 billion) to 60 billion euros ($64.4 billion) in revenues in 2030. The midpoint of that forecast implies its revenue will grow at a compound annual growth rate (CAGR) of 12% from 2022 to 2030. Analysts expect its revenue and earnings to grow 26% and 34%, respectively, this year. Those are rock-solid growth rates for a stock trading at 29 times forward earnings.

The winner: ASML

Nvidia and ASML are both solid long-term plays in the semiconductor market. However, ASML's monopolization of the high-end lithography market, stable growth rates, and lower valuation still make it a more attractive investment than Nvidia.

Nvidia's stock isn't irrationally valued relative to its growth yet, but its valuations seem to have been inflated by the market hype regarding generative AI technologies. Therefore, investors can consider buying ASML's stock now -- but they might want to wait for Nvidia's valuations to cool off a bit before jumping in.