Recessions are often the best times to buy positions in long-term stocks, but the present can seem awfully scary. The market tends to look about six months to a year ahead, but if you can look multiple years out, you have an advantage over most money managers. 

In economic downturns, consumers and businesses pull back on spending, which lowers economic growth. As we saw in both of the past two downturns in 2008 and 2020, government intervention is often crucial to stop the negative tailspin when a recession happens.

However, you shouldn't necessarily depend on the government to swoop in, or to do so effectively. That's why when a downturn occurs, it's best to pick up well-capitalized, competitively advantaged businesses you know will get through the crisis -- and perhaps even take advantage of it.

While a recession would affect the near-term financial results of Apple (AAPL -0.35%), Alphabet (GOOG 9.96%) (GOOGL 10.22%), and Lam Research (LRCX 2.65%), these three all-star companies should be on your short list whenever the economy takes a tumble.

People grab at dollar bills falling from the sky outside a city building.

Image source: Getty Images.

Apple

Although Apple has done an excellent job building a recurring services business over the past decade, over 80% of Apple's revenue still comes from one-off hardware purchases such as iPhones, Macs, and air pods. Those product sales would probably take a hit during an economic downturn.

Of course, the COVID recession was unique, as consumers stuck at home during the pandemic looked to upgrade their home technology. As a result, Apple grew product revenue, coming off a down year during the U.S.-China trade war in 2018-2019. Still, no two recessions are exactly alike. Apple's hardware and even some nonrecurring services revenues could take more of a hit during the next financial downturn. If that happens, its stock could fall a lot.

If it does, however, investors should look to scoop up shares. Apple has a fortress of a balance sheet, with $195.6 billion in cash and marketable securities, against just $107 billion in term debt as of last quarter. That gives Apple the firepower to withstand a downturn, repurchase its own stock at a discount, and still invest in the next big product.

With the world's most valuable brand, according to Forbes, Apple's recovery from a potential economic downturn is generally a question of when, not if. Customers have incredible loyalty to Apple, either when replacing their phones or computers, trying out a new product such as the more recent airpods, or anything else Cupertino comes up with down the road, such as a potential Apple car.

A search bar on a screen.

Alphabet could go on sale in the next recession. Image source: Getty Images.

Alphabet

Do you know what the second-most valuable brand is, according to Forbes. It's Alphabet, the parent company of the world's dominant search engine in Google. Like Apple, a good portion of Alphabet's revenue is economically sensitive; last quarter, Alphabet generated 81% of its revenue from digital advertising.

In a recession, companies tend to spend less on advertising, which could hurt Alphabet's results. We saw this happen during the second quarter of 2020, when Alphabet's revenue growth turned negative for the first time ever.

However, like Apple, Alphabet's downturn didn't last long. By the fourth quarter, businesses had moved on to reconnect with their customers. With everyone stuck at home on their phones and computers, ad spending returned to Google search, Google's ad networks, and YouTube. Year-over-year ad revenue rebounded strongly in the fourth quarter, growing 22%.

Importantly, Alphabet has a pretty compelling new business developing as well: Google Cloud, a strong third-place contender in the cloud infrastructure oligopoly. Cloud computing is still in its relatively early stages, and last quarter, Google's cloud platform grew revenue 47%. While the unit still makes rather sizable operating losses, Google is doing the absolute right thing investing heavily in this long-term growth opportunity.

Like Apple, Alphabet also has a terrific balance sheet, with $137 billion of cash and just $14 billion in debt. So it has the ability to repurchase shares in a recession, as it did last year, opportunistically buy other companies, as it recently did with Fitbit, and invest in futuristic technologies like Waymo, its self-driving car project.

So if investors sell off Alphabet's stock in the next recession on fears of an advertising slowdown, it should remain another stock on your short list of bargain stocks to buy.

A  lab technician inspects a processor up close.

Image source: Getty Images.

Lam Research

Some of the best companies to buy in a recession -- though some of the scariest as well -- are highly cyclical companies. Companies with highly variable results may sell off far more than warranted in downturns, and investors can profit when they roar back.

Such is the case with Lam Research, one of the big leaders in semiconductor equipment. Although both Apple and Alphabet have mildly cyclical qualities, the semiconductor sector is much more volatile. Semiconductors are physical products that aren't really "recurring" revenue. In an economic downturn, chip sales tend to fall as customers pull back on spending and lower inventories. If a chip is a relative commodity, such as memory or storage, not only do units fall, but prices can crash as well. As a result, semiconductor manufacturers pull back on machine purchases amid lower demand.

One can see this when looking at Lam Research's fiscal 2019 results, when revenue fell 13% and operating income fell 22% amid the U.S.-China trade war. Still, even in that "industrial recession," Lam was still quite profitable and generated ample free cash flow. Lam also has a relatively high 33% of revenue coming from services, much of which are recurring. The company has a terrific balance sheet, too, with $6 billion in cash against $5 billion in debt. And while the semi sector is cyclical, it's definitely a growth industry when zooming out over the long-term, and should make higher highs and higher lows over time.

We are now firmly in one of those boom times, as semiconductor demand is surging and, along with it, revenue and profit growth for Lam. However, had you invested during the last downturn in late 2018, you could have just about quadrupled your money in two years. In the next downturn, make sure you don't miss the opportunity.