Despite the market's poor performance in 2022, with the S&P 500 down more than 20%, there are still attractive investment opportunities to take advantage of in this environment. And I strongly suggest prioritizing business quality over anything else right now. This means taking a close look at things like competitive advantages and profitability metrics. 

With trailing five-year returns of 202% and 367%, respectively, Costco Wholesale (COST 0.34%) and Lululemon Athletica (LULU -0.98%) are my two favorite stocks right now. Let's take a closer look. 

1. Costco Wholesale

Costco's massive scale, with fiscal 2022 total revenue of $227 billion, is a key reason for its remarkable success. The business is able to flex its incredible bargaining power with suppliers to negotiate favorable purchasing terms. And these savings are immediately passed on to customers in the form of lower prices at its 839 warehouses. The average markup on Costco merchandise is 11%, while it can be multiples of that at other top retailers. 

And these low prices for consumers are exactly why Costco should be able to weather any macroeconomic headwinds in the near term. During the worst of the pandemic, people shopped at Costco to handle all of their needs in one trip. And when times get tough, people can turn to it to get more bang for their buck, buying essential items in bulk on the cheap. It's not only a win-win for customers, but it's also a win-win scenario for Costco. 

Shoppers must be members to visit Costco warehouses, and this is a lucrative model for the business. In fiscal 2022, it generated $4.2 billion in membership fees, up 9% year over year, most of which flows straight to the bottom line. And the membership renewal rate in the U.S. and Canada was 92.6% last quarter, providing stability and predictability for the company. As of Aug. 28, there were 65.8 million Costco membership households.  

After falling 13% in the last month, shares trade for a price-to-earnings (P/E) ratio of 36. While this is certainly more expensive than the S&P 500's valuation, as well as the P/E multiples of rivals like Walmart and BJ's Wholesale Club Holdings, I think it's a smart decision for investors to pay up for such a wonderful business. There's no reason to believe that Costco won't be even more relevant for consumers a decade from now, and this supports a rising stock price.

2. Lululemon Athletica

With trailing 12-month sales of $47.1 billion, many investors probably view Nike as the undisputed king in the sports apparel market. And with its long operating history, that viewpoint is correct.

But Lululemon is quickly rising, and it actually has better profitability than Nike. In the fiscal 2022 second quarter (ended July 31), Lululemon's gross margin of 56.5% and operating margin of 20.9% were both much better than Nike's, a trend that has held up over the past several years. 

What's impressive is that Lululemon's annual revenue growth over the past five fiscal years has averaged a superb 22.2%, with outstanding performance throughout the pandemic as well. But the management team isn't satisfied. It believes that by 2026, annual revenue could reach $12.5 billion, double fiscal 2021's total, which will be achieved by quadrupling international revenue and doubling both digital and men's sales. 

A valid argument can be made that Lululemon, which sells high-priced apparel and footwear, would struggle in a recessionary environment as consumers place a tighter grip on their discretionary spending. During the Great Recession, however, the business was able to increase revenue 30.9% in fiscal 2008 and 28.1% in fiscal 2009. And sales growth has shown no signs of slowing down in recent quarters. Add this to a cash balance of $499 million and no debt, and Lululemon should be fine no matter which way the economy turns. 

Despite being down 26% in 2022, Lululemon's stock still trades at a P/E multiple of 34 today. Given the shares' impressive historical gains and the company's excellent revenue and profit growth, it's not a surprise that they trade at a premium to Nike's. But as is the case with Costco, I believe that it's worthwhile to own the stock. Lululemon will be a far bigger business a decade from now.