Though the S&P 500 closed out Friday near a record high, the bull market hasn't been kind to all stocks. Indeed, many of the high-flying growth stocks of 2020 have lagged this year or have even declined. This means that even though some stocks are trading near (or at) all-time highs, many or not. Indeed, some of the stocks that have floundered this year are among the highest-quality companies on Wall Street.

Two great examples of top stocks trading at attractive valuations relative to their long-term prospects are Chipotle Mexican Grill (CMG 0.17%) and Amazon.com (AMZN -1.14%). With negative year-to-date returns, it's a good time for investors to consider buying stakes in these top-notch companies.

A woman looking at a stock chart on a laptop.

Image source: Getty Images.

1. Chipotle

Fast-casual burrito specialist Chipotle may have run into a detour about five years ago amid a food health scare and a poorly implemented marketing campaign in its aftermath. Since then, however, the company has posted years of consistently impressive financial results, sending the stock to new highs earlier this year.

While Chipotle's strong financial results have persisted this year, its stock's upward move higher hasn't. Shares have slid along with many other growth stocks as investors have been spooked by some companies' frothy valuations. Chipotle stock is now down 4% year to date, compared to the S&P 500's 13% gain during this timeframe. Even more, the stock is down 16% from an all-time high achieved earlier this year.

But Chipotle stock's pullback has arguably gone too far. Yes, with a price-to-earnings ratio of about 93 as of this writing the stock doesn't look cheap at first glance. But this company's fast-growing business justifies a premium valuation. Trailing-12-month revenue, for instance, is $6.3 billion -- up from $6.0 billion in 2020, $5.6 billion in 2019, and $4.9 billion in 2018. 

Further, the company has shown that simple menu and restaurant innovations and improvements to its digital loyalty program can serve as major drivers for Chipotle's overall business. And not only has Chipotle's revenue been growing rapidly but its restaurant-level operating margin has been expanding, capturing the scalability of the food chain's business model.

2. Amazon.com

If there's one thing Amazon's most recent quarterly results tell us, it's that the e-commerce and cloud-computing boom that the company has consistently capitalized on is far from over. Amazon's total first-quarter sales rose 44% year over year to $108.5 billion. Further, the company is leveraging its scale of more than 175 million Prime members and its $54 billion annual run rate of cloud-computing sales to generate massive profits. First-quarter net income was $8.1 billion, up from $2.5 billion in the year-ago period.

With Amazon shares down almost 2% year to date, now is a great time for investors to get in on the world's most successful e-commerce and cloud-computing company. Likewise, Chipotle shares are beginning to look attractive at 93 times earnings; the company's ability to generate incremental shareholder value with simple innovations shows why this is a management team investors want to bet on.

While no stock is guaranteed to be a winner, the odds seem high that these two quality stocks will perform well over the long haul.