After the coronavirus first hit the U.S. in the spring of 2020, sending the stock market into a tailspin, the Federal Reserve implemented major stimulus efforts to boost the economy. Although it worked, we're now seeing skyrocketing inflation that needs to be tamed. The planned solution, raising interest rates during the course of 2022, can seriously slow down economic growth and potentially put the U.S. in a recession. 

If this scenario scares you, you might want to look at this unstoppable brick-and-mortar retail stock to protect your portfolio and peace of mind. Its share price has increased 134% over the past five years. 

Thriving in tough times 

Selling car batteries, brakes, and windshield wipers, among a broad assortment of other products, is what O'Reilly Automotive (ORLY 0.10%) does exceptionally well. The business is able to serve both do-it-yourself mechanics and professionals with its domestic footprint of 5,811 stores. While the company might seem boring, it can be a solid addition to your portfolio in uncertain times like these. 

We only have to look back 14 years to see that O'Reilly can flourish during a recession. In 2008 and 2009, year-over-year revenue growth was 41.8% and 35.5%, respectively, which were the highest gains the company registered in at least the past couple of decades. 

When times are tough, instead of buying new cars, consumers are more likely to extend the useful lives of their existing vehicles. And to do this, they need to shop at an auto parts store. Therefore, if a recession does happen in the near future, investors can be confident that the business will do just fine. 

Further adding to O'Reilly's favorable characteristics are superb financials. Not only does the company possess a gross margin of 51.8% and an operating margin of 20.3%, but it also has consistently produced positive free cash flow throughout its history. Moreover, earnings per share have climbed at a compound annual rate of more than 20% over the last decade. 

stressed business person looking at a falling red chart on laptop.

Image source: Getty Images.

All-weather appeal 

But this isn't just a stock to own if you think bad times are ahead. When the economy is roaring and unemployment is low, people tend to drive more often. This results in increased wear and tear on vehicles, and O'Reilly once again benefits. 

Since the Great Recession (excluding the start of the pandemic), the U.S. economy has expanded steadily. As a result, O'Reilly was able to post consistent sales and profit growth during this time, a clear indication of its all-weather appeal. 

And there are legitimate reasons to believe that the business will continue to do well as we look ahead. For example, the number of miles driven in the U.S., a key metric management tracks, keeps marching higher with each passing month on a year-over-year basis. Again, this means greater wear and tear on vehicles, supporting demand for O'Reilly's products. 

Second, the average age of cars on the road stood at 11.9 years in 2020, up from 10.6 years in 2010. Better-engineered and more technologically-advanced vehicles last longer, which raises their useful lives outside of the original manufacturers' warranty. This is O'Reilly's sweet spot. 

But there are some risks investors should be aware of. In the near term, higher gas prices could discourage consumers from driving as much. And the booming growth of electric vehicles (EVs) is a potential long-term threat to O'Reilly's entire business because maintenance and repairs might be performed only by the manufacturer. While car companies are investing massive amounts of money to electrify their product lineups, I still think we are a long time away from EVs becoming a meaningful part of the domestic car population. 

Interest rates are set to keep on rising. And this will probably lead to a dramatic economic slowdown. Luckily, O'Reilly shareholders don't have to worry about what happens next.