Lam Research's (LRCX -0.76%) stock price dipped nearly 2% after its fiscal 2022 first-quarter results were released on Oct. 20. Some investors were giving the company's weaker-than-expected guidance a thumbs down.

However, shares of the semiconductor-equipment supplier have surged impressively over the past month (see chart below). Lam Research stock's recent rally isn't surprising as it gives investors a way to tap into the global semiconductor shortage and the booming demand for memory chips.

Let's look at the reasons why buying Lam stock right now could turn out to be a smart move for the long run.

LRCX Chart

LRCX data by YCharts.

Lam Research is growing at a terrific pace

The company's Q1 revenue had shot up 35% year over year to $4.3 billion. The impressive top-line growth was driven by higher sales of semiconductor-fabrication equipment and the increase in demand for customer support, as Lam customers looked to enhance the productivity of their installed equipment to increase utilization and meet the robust chip demand.

Lam's adjusted earnings shot up 47% year over year in the third quarter to $8.36 per share, despite higher freight and logistics costs on account of supply-chain constraints. However, Wall Street was expecting $8.23 in earnings per share on $4.32 billion in revenue, so Lam's numbers were a mixed bag as it missed the top-line estimate. The near-term guidance didn't meet expectations, either.

Lam expects Q2 earnings of $8.45 per share on $4.4 billion in revenue at the midpoint of its guidance range. While that would translate into solid year-over-year growth over adjusted earnings of $6.03 per share and revenue of $3.46 billion in the prior-year period, Wall Street was looking for more. Lam's projections fell slightly short of analysts' expectations of $8.47 per share in earnings on $4.41 billion in revenue.

Management pointed out on the October earnings conference call that Lam Research is facing "output challenges in our global supply chain that are continuing to negatively impact both our revenue and gross margin." Lam CFO Doug Bettinger added that "lead times remain stretched, and we continue to have unmet demand."

Man looking at a line chart on a laptop.

Image source: Getty Images

The company could have easily outpaced expectations had it not been for the supply-chain challenges it's facing. Savvy investors, however, should focus on the bigger picture, as the market in which Lam operates is set for secular growth.

The company supplies fabrication equipment to foundries and memory manufacturers through its systems segment, which produced 69% of its total revenue last quarter. The segment's revenue was up 36% year over year, driven mainly by robust demand from memory manufacturers. More specifically, 64% of Lam's revenue comes from supplying manufacturing equipment to DRAM (dynamic random access memory) and NVM (non-volatile memory) suppliers.

The good part is that memory manufacturers have committed billions of dollars toward ramping up their manufacturing capabilities in the coming years, which should pave the way for long-term growth at Lam Research.

Heavy investments in memory manufacturing will be a tailwind

Memory-chip demand is expected to rise rapidly in the coming years, thanks to applications such as the Internet of Things, connected cars, high-performance computing (HPC) data centers, and 5G smartphones, among others. A third-party report estimates that the global memory market could generate nearly $368 billion in revenue by 2024, as compared to $173 billion in 2019.

Not surprisingly, memory manufacturers are ramping up their investments to boost production. Micron Technology recently announced that it will be spending $150 billion over the next decade in memory manufacturing and research and development (R&D) to meet the end-market demand.

Samsung, on the other hand, is planning to spend a total of $205 billion on its key businesses over the next three years, which includes both non-memory and memory chips. SK Hynix, another memory manufacturer, had also said earlier this year that it plans to expand its manufacturing capacity.

Given these tailwinds, it's not surprising to see why analysts expect Lam's revenue to increase 21% this fiscal year, while earnings are expected to jump nearly 27% over the prior year. What's more, Lam's earnings are expected to increase at an annual pace of more than 16% for the next five years. It's also worth noting that investors can get into Lam stock at an attractive valuation as it's trading at just 22 times trailing earnings right now, as compared to the S&P 500's average of almost 29.

All of this makes Lam a top tech stock to buy right now as it can sustain its recent rally and deliver more upside in the long run.