In the last decade, the Nasdaq Composite has been very good to investors. The tech-heavy benchmark returned 310% during this time, including dividends. But there's a retail stock in the index that has performed significantly better.

I'm talking about O'Reilly Automotive (ORLY -0.97%). Shares of the aftermarket auto parts seller have soared 619% since Feb. 27, 2014, turning a $10,000 initial cash outlay into a whopping $71,880 today. Is it time to buy this phenomenal stock right now?

Boring is best

High-flying tech companies that have exposure to the artificial intelligence trend are getting all the attention from investors these days. But don't let that excitement distract you from O'Reilly and its boring business model.

With 6,095 stores across the U.S., this company sells things like brakes, motor oil, and wiper blades to DIY and professional car mechanics. It might fly under the radar, but O'Reilly has a successful history of strong fundamental performance.

Between 2018 and 2023, the company's revenue and diluted earnings per share increased at compound annual rates of 10.6% and 19%, respectively. What's even more impressive than these headline figures is how O'Reilly was almost untouched during the coronavirus pandemic, growing sales by 14% and net income by 26% in 2020.

The business generated a ton of free cash flow to the tune of $2 billion last year. After reinvesting in growth initiatives, like opening new stores or expanding distribution capabilities, management focuses on buying back lots of stock. In the past 10 years, the outstanding share count has been reduced by 46%.

Protecting the downside

The industry O'Reilly operates in is highly fragmented, meaning there are a lot of smaller and independent shops in competition with it. Because customers have a sense of urgency when finding the right parts to make sure their cars work properly, having adequate inventory is absolutely essential. This is where O'Reilly's scale can help win other new customers, helping it gain market share over time.

Besides the strong competitive standing and growth runway, O'Reilly is a recession-proof enterprise. The 12-month period that ended Dec. 31 was the 31st straight year that the business reported same-store sales growth. This consistency speaks volumes about just how durable the company is.

When economic times are favorable, consumer spending is robust, and interest rates are low, people tend to drive more. This increases the wear and tear on their vehicles, supporting higher demand for O'Reilly's products.

On the other hand, in uncertain or even recessionary times, like what many might consider an apt description of the current economic climate, consumers will hold off on buying new vehicles. With interest rates where they are today, this certainly could be the case. In this scenario, people will invest in extending the useful lives of their existing cars, again supporting demand for O'Reilly.

Investors who own this business in their portfolios don't have to spend one second thinking about what direction the economy is heading in. Instead, you can sleep well at night knowing the company will perform well no matter what the macro backdrop looks like.

Paying a premium

Thanks to the stock's tremendous performance, investors are being asked to pay a price-to-earnings (P/E) ratio of 28.4 right now. This is a steep premium to the stock's trailing-10-year average of 22.9, and it's more expensive than the S&P 500's P/E multiple of 23.

One can easily justify paying this price tag for what is clearly an outstanding business. However, it's also a valid argument that the valuation might be a bit stretched right now. Perhaps the best course of action is to dollar-cost average over several months.