Warren Buffett is accustomed to making a lot of money. That's to be expected for anyone with a net worth hovering around $100 billion.

But there have been periods where the iconic investor hasn't raked in big bucks. Buffett's Berkshire Hathaway (BRK.A 0.99%) (BRK.B 0.91%) portfolio isn't immune to tough times when the economy performs dismally. 

During the last major recession, nearly every stock Buffett owned declined. However, there was a lone exception. Here's the one stock that made Buffett money.

A few assumptions

Before I identify the stock, let me first explain some assumptions that I made. Most importantly, I didn't count the recession of 2020 as a major recession. This recession, which resulted from the COVID-19 shutdowns, was unusually short. The last truly major recession, in my view, was the Great Recession. It began in late 2007 and didn't end until mid-2009. 

Also, I only looked at stocks that Buffett held throughout the Great Recession. In particular, I researched the performance of all stocks in Berkshire's portfolio as of its 13-F filing on Nov. 14, 2007, that were still included in the 13-F filing on Aug. 14, 2009. 

Finally, I excluded any stocks that aren't still publicly traded as they were back then. For example, Burlington Northern Santa Fe was one of multiple stocks in Buffett's portfolio during the Great Recession but is now a wholly owned subsidiary of Berkshire Hathaway. 

Buffett's only winner

Now that we've addressed those details, it's time to unveil Buffett's one stock that made him money in the last major recession. And that stock was... Walmart (WMT 1.02%).

The chart below shows how Walmart stock performed during the Great Recession. Note that the time range includes a few days in late November 2007 before the recession officially began and a few days after its end in mid-2009.

WMT Chart

WMT data by YCharts

It's important to understand just how impressive of an accomplishment Walmart's double-digit percentage gain actually was. The S&P 500 plunged more than 30% during this period (and fell much more steeply at its nadir). Most of the stocks in Berkshire's portfolio (including Berkshire itself) sank by double-digit percentages.

How Walmart won

Walmart's business model probably ranks as the key reason behind its exceptional stock performance during the Great Recession. The company focused then and now on offering a wide range of products at "every day low prices." 

When consumers face significant uncertainty about their personal finances, they try to stretch each dollar that they have. Walmart's discount retail stores met that need in the midst of one of the worst economic crises in U.S. history.

Importantly, Walmart continued to grow despite the macroeconomic headwinds. The company's net sales jumped 7.2% year over year in its fiscal year ending Jan. 31, 2009, which included much of the recessionary period. Its profits rose 5.3%. Walmart also added 165 new supercenters in the U.S. during this time.

The underlying resilience of Walmart's business model caused many to view the stock as a safe haven. As a result, Walmart attracted interest from investors who were afraid of putting their money into other assets. 

Lessons for today

We're not in a recession right now. However, the Federal Reserve continues to crank up interest rates. It's quite possible (and perhaps even probable) that 2023 will bring another major recession.

Could Walmart again outperform most stocks? It seems likely. Indeed, the retail giant is handily beating the S&P 500 so far this year as fears of a recession have risen.

Walmart will probably keep winning for the same reasons that it delivered positive returns during the Great Recession. Consumers are still looking for lower prices. That's especially true with the high inflation we're experiencing. Walmart is still the kind of stock most likely to thrive during a recession.

There's one key difference for Buffett now, though: Walmart isn't in Berkshire's portfolio. However, New England Asset Management, a subsidiary of Berkshire, does own shares of the discount retailer. Walmart just might make Buffett even more money in the next major recession.