If there's one thing we should have learned over the past few years, it's that no one can predict what is going to happen next with the economy.

There was a global pandemic, supply chain issues, inflation, and now a potential economic downturn in our near future. The best thing stock market investors can do to manage the constant uncertainty is to properly position their portfolios for anything that might come. 

With its shares up 26% in the last 12 months, you might want to seriously consider this recession-proof stock. Here's why. 

Uncertain times 

The Consumer Price Index, which measures inflation, came in at 6.5% in December, so it's safe to say that the central bank still has a lot more work to do to get prices under control. While the Federal Reserve aggressively raised interest rates in 2022, it will continue to do so, though at a slower pace this year. The goal is to get inflation near the 2% target, so we're still a long way off. 

This ongoing tightening policy has many financial experts predicting that a recession is on the horizon, including JPMorgan Chase CEO Jamie Dimon. Even individual consumers are preparing for difficult times ahead. According to Gallup, Americans are extremely pessimistic about where the economy is headed, with 46% of respondents rating the economy as being in poor shape in a November poll. 

With this kind of macro situation in play, it's probably best for investors to bolster their portfolios by seeking out recession-proof companies, or those that can perform well throughout difficult times.

O'Reilly's resiliency 

One such business is O'Reilly Automotive (ORLY 4.17%), which sells items like brakes, batteries, filters, and wiper blades to both DIY and professional customers through its network of more than 5,900 stores nationwide. The company saw revenue surge more than 14% in both 2020 and 2021. Things did slow down somewhat in 2022. For the third quarter (ended Sept. 30), sales were up 9.2% on a year-over-year basis. This is solid growth, especially when you consider difficult prior-year comparisons. The momentum is clearly still strong. 

What stands out about this company is how well it performs in recessionary times. When consumers are tightening their spending and trying to stretch their budgets, they will likely hold off on buying new vehicles, instead choosing to extend the useful lives of their current cars by focusing on maintenance and repairs.

The business hasn't had a single yearly revenue decline in the past 20 years, and was able to post double-digit growth in each year between 2008 and 2010, a period scarred by the Great Recession. This resilient demand dynamic positions the company well should the economic situation deteriorate at all in 2023. 

Moreover, O'Reilly is a profit-making machine. In the latest quarter, gross margin of 50.9% and operating margin of 21.2% were both superb, and they have both expanded over time. The result is an enterprise that generates tons of free cash flow (FCF), which has enabled the management team, led by CEO Greg Johnson, to aggressively buy back its own stock over the years. In fact, O'Reilly has spent $2.9 billion on repurchases in the first nine months of 2022, translating into just under 6% of the current market capitalization.

For the fourth quarter, which ended on Dec. 31, the executive team expects same-store sales to rise 5% at the midpoint, with FCF coming in between $1.8 billion and $2.1 billion. And for 2023, Wall Street consensus analyst estimates call for revenue and earnings per share to increase 5.5% and 12.2%, respectively. 

Shares of O'Reilly have climbed at an impressive 195% over the past five years, easily beating the S&P 500 during that time frame. And after significantly outperforming the market in 2022, the stock currently trades at a price-to-earnings multiple of 24, which is slightly above its trailing-10-year average valuation. 

But for investors who are trying to prioritize protecting their portfolio's downside risk, while maximizing peace of mind, it's hard to find a better business to own than O'Reilly in 2023.