Aftermarket auto parts retailer O'Reilly Automotive (ORLY 5.68%) posted another stellar quarter, demonstrating that its powerful momentum from the pandemic has yet to fade away. The underlying business fundamentals could not be any stronger, resulting in a record year. And the stock's performance reflects this. 

Over the past year, O'Reilly shares have surged 45%, crushing even the world's most valuable cryptocurrency, Bitcoin, which fell 9% (as of Feb. 11) during the same time. 

O'Reilly shows no signs of slowing down. 

Customer shopping for motor oil in auto store.

Image source: Getty Images.

A strong finish to 2021 

In the most recent quarter (ended Dec. 31), O'Reilly's same-store sales (or comps) increased 14.5% compared to the prior-year period. Comps for the full year jumped 13.3%, marking the 29th consecutive year of comps growth. Both the DIY and professional segments registered higher average ticket sizes and transaction counts, indicating solid demand. 

"Demand in our industry has remained very resilient for the past two quarters, even as price levels and the broader economy have risen sharply," CEO Greg Johnson mentioned on the earnings call.  

Ever since the start of the pandemic, O'Reilly's business has been firing on all cylinders. Surging car prices have resulted in consumers deciding to extend the lives of their existing vehicles, a situation that boosts demand for the brakes, batteries, and range of other products the company sells.  

Despite inflationary pressures on the cost side having a negative impact, O'Reilly has been able to pass on higher prices to customers. Both the gross margin and operating margin expanded in Q4 2021 compared to Q4 2020. And diluted earnings per share (EPS) rose 41%. 

After opening 165 net new stores in 2021, O'Reilly still produced free cash flow of $2.5 billion (on total revenue of $13.3 billion). This favorable financial situation allowed the business to repurchase $2.5 billion worth of stock over the course of the year. And over the past decade, O'Reilly's outstanding share count has shrunk by nearly half. It's no wonder that annual EPS growth has averaged an astonishing 23.9% from 2012 through 2021. 

O'Reilly Automotive has now exceeded Wall Street analyst estimates for both revenue and EPS for eight straight quarters. This is a boring, steady, and predictable business that continues to post fantastic results that impress investors, and the share price has shown this. 

Outlook for 2022 shows continued growth 

Even with two straight outstanding years in 2020 and 2021, O'Reilly is expected to continue its great fundamental performance this year. Management forecasts comps to grow 5% to 7%, and it plans to add an estimated 180 net new stores (at the midpoint) in 2022, which would bring the total to just shy of 6,000. 

"For the DIY side of our business, we anticipate delivering generally stable to slightly negative ticket counts, with the headwind coming from lapping the positive impact of government stimulus in the first half of 2021 and expected pressures from increased prices," Johnson said. 

The professional segment has much better long-term growth prospects, and the leadership team expects transaction counts to rise. The end consumer is usually in a much better financial position than a DIY customer. And with the slow return of office commutes, miles driven should trend higher, supporting excess wear and tear on vehicles. 

The fading effects of the record government stimulus injected into the economy in response to the pandemic will certainly add downward pressure to demand in the near term, but the executive team believes that no matter the economic situation, the business will be just fine.  

In a worst-case scenario, where the economy goes into a recession, O'Reilly would still be able to thrive. Economic uncertainty typically leads consumers to invest in their existing cars and hold off on buying new ones. Therefore, this all-weather business provides investors with valuable downside protection. 

Pair the limited risk of owning O'Reilly stock with the remarkable financial performance we've seen over the past couple years, and this has the ingredients of a winning investment.