Shares of Costco Wholesale (COST 1.01%) were heading lower today even as there was no news out on the warehouse retailer. Instead, the stock fell in tandem with Walmart (WMT -0.08%), which spooked investors about the fourth quarter even as its third-quarter results were solid.

As a result, Costco stock was down 2.5% as of 1:02 p.m. ET, while Walmart had lost 7.6% at the same time.

A parking lot outside of a Costco.

Image source: Costco.

Costco lets some air out

The sell-off in Walmart stock was surprising, as its third-quarter results were better than expected and the company actually raised its earnings guidance. However, the full-year guidance was weaker than expected, implying that fourth-quarter profits would miss the mark as well.

Commentary on the earnings call also weighed on the stock, as Walmart CFO John Rainey called out volatility in weekly sales and a softening in the second half of October. It also said revenue growth would slow as food inflation moderated.

Walmart is the world's largest retailer and a bellwether for the retail industry and the broader economy. It's also a close rival with Costco, and Walmart also reported slowing comparable sales at Sam's Club, its membership-based warehouse chain, which were 3.8% excluding fuel in the quarter.

Costco operates on a different fiscal calendar than most retailers, so it won't report earnings until next month. In its most recent update, Costco said that comparable sales excluding foreign exchange and fuel prices were up 3.4% in October, while overall net sales rose 4.5% to $18.53 billion.

Where does Costco stock go from here?

While Walmart and Costco make most of their revenue from groceries, the two companies could be vulnerable to a pullback in consumer spending because the stocks have performed so well recently, meaning valuations have gotten stretched.

That could put Costco stock under pressure over the coming quarters. Because most of its profit comes from membership fees, Costco's business is more stable than most, but it still relies on sales growth. At a price-to-earnings ratio of 41, the valuation is high for a retailer with just 3% comparable sales growth.