Thanks to a strong track record for growth in both businesses, Costco (COST -0.12%) and Home Depot (HD -0.31%) stocks are rarely put on sale. Valuation drops can disappear quickly, too, as investors snap up these industry leaders on the expectation that their future will contain more dominant growth and earnings results.

Yet the retailers are each trading below the all-time highs they set in early 2022, implying potentially solid returns for investors willing to buy the stocks today. With that prospect in mind, let's look at which one would be the better fit for your portfolio.

The growth matchup

Both companies are enduring a growth hangover today compared to booming demand trends in earlier phases of the pandemic. Costco's March comparable-store sales trends slowed to just a 1% uptick in the core U.S. market, for example. Home Depot announced a 0.3% decrease in mid-February, too, in the fourth-quarter period that ended in late January.

Yet Costco wins in this matchup, given its better traffic trends. Customer traffic was up 3% in the most recent quarter and has been steadily expanding at a similar clip even as shoppers became more cautious in their spending. Home Depot, meanwhile, reported a 6% drop in customer traffic in fiscal 2022 that was entirely offset by higher average spending.

A wider foundation

The risk profile is lower for Costco, too. The retailer sells a wide range of both consumer staples and discretionary products, which lessens its exposure to downturns in areas like housing or home furnishings.

Customers prize Costco's price leadership in times of inflation, too, as is clear from the fact that the company just hit a new record 92.6% membership renewal rate.

Most of the chain's earnings come from those highly predictable fees, whereas Home Depot must rely on a steady stream of daily sales to generate its profits. Costco's membership club approach is valuable in any market but is especially helpful during rocky economic times like these.

The better buy

Home Depot is the clear winner in key financial metrics, though. Its 14.5% operating profit margin trounces the 3% that shareholders typically see from Costco and is also well ahead of rival home improvement specialist Lowe's (LOW -0.14%).

Home Depot pays a generous dividend of roughly 55% of annual earnings, too, and has made a habit of steadily boosting that payout. Costco's management team prefers instead to rely on sporadic special dividends as a favored channel of direct cash returns.

But investors are being asked to pay a big premium for those financial strengths. Home Depot shares are trading at a premium 1.9 times annual sales, making it look expensive compared Costco's 0.9 ratio and Lowe's ratio of 1.3. Income investors might still prefer Home Depot's stock at that valuation due to the company's 2.7% yield compared to Costco's 0.7% yield.

But, overall, Costco seems like the more attractive stock today. The business has never been more popular with shoppers and is likely to maintain solid momentum even if economic trends continue to worsen. That lower risk, combined with steady growth, makes Costco the leading contender in this matchup between two excellent retailing businesses.