Investing in the stock market, while made out to be complicated and intimidating, can be a simple exercise. The best course of action is to find quality businesses with competitive advantages. And focus on owning them for a very long time, at least five years. By prioritizing these things, anyone can benefit from the wealth-generating capabilities of the market. 

I believe that Apple (AAPL -0.35%), O'Reilly Automotive (ORLY -0.97%), and Visa (V -0.23%) are companies that fit the quality standards I just mentioned. Even with just $1,000 to invest, it's a good idea to spread that out evenly among these three top stocks. Let's take a closer look. 

1. Apple 

It's the most valuable business in the world, with a market cap of $2.9 trillion. The iPhone is still its crown jewel, representing 54% of overall company revenue in the fiscal 2023 second quarter (ended March 31). All hardware accounts for 78% of sales. 

But shareholders should start paying attention to the Services segment, which includes things like Apple Pay, Apple TV+, and Apple Music. Revenue in this division increased 5% year over year last quarter, faster than the overall business. If it keeps this up, profits should get a lift, since this segment carries a superb gross margin of 71%. 

Over the past five years, Apple shares have risen 302%, easily beating the Nasdaq Composite Index's 76% return. After this type of performance, the stock isn't necessarily cheap, trading at a price-to-earnings (P/E) ratio of 32.

But to own one of the most dominant enterprises in the world that sells some of the most in-demand products and services, investors might be fine with paying a premium valuation for Apple. 

2. O'Reilly Automotive 

With over 6,000 stores, O'Reilly is one of the leading auto parts retailers. It has registered steady increases in revenue, same-store sales, and profits throughout the last decade by catering to both DIY customers and mechanics. And there's no reason to believe this impressive track record won't continue. 

The business benefits from the growing population of aging cars, with more wear and tear resulting in strong demand for what O'Reilly sells. And even in recessionary times, when consumers delay purchasing new vehicles and focus on fixing their existing ones, the company is positioned for success. 

O'Reilly won't ever win the award for the most exciting company. This isn't a high-flying tech business that is developing innovative and disruptive products. It's a durable, predictable, and boring retailer that consistently generates lots of free cash flow. That makes for a good investment candidate. 

The stock has been a huge winner, up 225% in the last five years. And it's up more than 50% in just the past 12 months. Maybe this strong momentum can continue. 

3. Visa 

Operating in a duopoly in the card payments industry, Visa is arguably one of the best businesses in the world. Its revenue has increased at a compound annual rate of more than 9% over the past decade. And during this time, the operating margin has expanded from 60% in fiscal 2012 to 64% last fiscal year. Visa is truly a world-class organization when it comes to profitability. 

Investors will appreciate that this business is a natural inflation hedge: Its payments volume can go up as prices across the economy rise. And more recently, the surging demand for travel has boosted Visa's cross-border volume, a boon since it earns more on these types of transactions. 

Of the three stocks on this list, Visa has performed the worst. Its shares are up "only" 69% in the past five years. That gain still beats the S&P 500, though. The stock trades at a P/E of 30 right now, which is below Visa's trailing-10-year average valuation. That also represents a notable discount to smaller Mastercard. It might be time to take advantage of this gap.