The U.S. economy is falling rapidly into a recession due to the expanding COVID-19 crisis. Since we will only know what industries weathered this recession best when it's over, we looked back to the last recession for some guidance. During 2008, during the Great Recession, only 34 stocks out of the S&P 500 had positive returns. There are many reasons why these particular stocks increased, and the impact of every economic recession is different. However, looking at which stocks did well can still show broad patterns as to what kinds of stocks may do better in economic downturns.

Here are the top 10 stocks in the S&P 500 by 2008 total return to give you some context, and then we'll break things down by industry.

Top 10 Stocks in the S&P 500 by Total Return During 2008
Company Name (Ticker) 1-Year Total Return Industry
Dollar Tree Inc. (DLTR) 60.8% Discount Stores
Vertex Phamaceuticals Inc. (VRTX) 30.8% Biotechnology
H&R Block Inc. (HRB) 25.8% Personal Services
Amgen Inc. (AMGN) 24.3% Drug Manufacturers-General
Old Dominion Freight Lines Inc. (ODFL) 23.2% Trucking
Walmart Inc. (WMT) 20.0% Discount Stores
Edwards Lifesciences Corp. (EW) 19.5% Medical Devices
Ross Stores Inc.  (ROST) 17.6% Apparel Retail
Alaska Air Group Inc. (ALK) 17.0% Airlines
Hasbro Inc. (HAS) 16.8% Leisure

Source: YCharts

Discount Retailers

The stock that beat all other S&P 500 stocks during 2008 was Dollar General, rising more than 60% that year, almost double the second highest-returning stock. In fact, the only industry to come up twice in the top 10 best-performing stocks of 2008 was discount stores, with Walmart in 6th place.

This makes intuitive sense as recessions reduce consumers' income. When consumers' incomes go down, they can either substitute cheaper goods or buy fewer items. Since there is a minimum of how many staple goods like food and basic household supplies you need to buy, you can't just cut them from your budget like you could with a new video game. That means that to save money on them, you will turn to cheaper alternatives. As a result, discount retailers are likely to do well in a recession.

Health Care

If you group together all companies related to the health care industry, there are three in the top 10, even more than discount retailers. Furthermore, there are a total of 7 different health care related companies among the 34 that had positive returns in 2008.

The reasoning behind this is clear. You need health care to live, and therefore are much less likely to skimp on it even when your income declines. The technical term for this is price inelasticity. Not all health care companies are created equal, and recessions are likely to hurt those companies with more debt and less cash flow. These enterprises have less ability to absorb losses and service their debt at the same time. Therefore, it may be prudent to stick to health care stocks that have low debt-to-equity ratios and avoid biotech startups that are still in their early phases.

Food and Restaurants

Similar to health care, people need food and can only cut spending on it by so much. Besides discount stores like Dollar Tree and Walmart, which are major grocers, several other companies that make or sell food also made the list. They include packaged food company General Mills, Inc., grocery store chain Kroger Co. (KR), and also restaurant chains McDonalds Corp. (MCD) and Darden Restaurants,Inc. (DRI) (owners of Olive Garden and other casual dining chains). All of these are relatively inexpensive food options, as people tend to purchase inexpensive items like cereal and switch to less expensive restaurants when they dine out.

Freight and Logistics

Goods need to be moved, recession or no. While personal travel for vacations declines during recessions, there is still a need to move goods to stock store shelves. Old Dominion Freight, Westinghouse Air Brake Technologies (WAB), and C.H. Robinson Worldwide (CHRW) all had positive returns in 2008. All of these companies either move freight or make products that help move freight, in the case of Westinghouse. So freight companies are often safe bets during recessions.

DIY and Repairs

When times are tight, one way to cut costs is to repair what you own rather than replace it, and to do routine maintenance yourself. That may be the reason for the strong 2008 performance from auto parts retailer AutoZone Inc. (AZO), and also from home and garden improvement retailers Tractor Supply Co. (TSCO) and Sherwin-Williams Co. (SHW). During a recession, consumers are more likely to repair their cars rather than buy a new one, as well as do home improvement and garden work themselves.

The Bottom Line

The above list isn't exhaustive, as investing during an economic downturn is an enormous topic. Other areas that are traditional defensive investments are utilities (people always need water and heat), and personal storage (a place to put things when downsizing). That said, this should give you a good place to start looking for how to invest during a recession. Good things to keep in mind are what goods and services people and business can easily live without and what ones are essential. In addition, keep in mind what businesses people may patronize more if their income decreases.

As mentioned, it's important to remember that each recession is different, and so will the stocks that do well during them. For example, a lot of biotech companies are rising at the moment due to the widespread COVID-19 crisis. Financial firms were devastated in the 2008 recession, because it stemmed from a financial crisis, but it's energy companies in 2020 are among the worst performers due to the current oil price war.

One final reminder is that stocks and industries that do well during a recession may not always do well when the economy recovers. So you will need to change your investment strategy when the good times return. Keep that in mind when building your portfolio.