Markets

These companies win when Wal-Mart beats Wall Street's earnings forecasts


A cashier completes a purchase at a Walmart store in Burbank, California.
Patrick T. Fallon | Bloomberg | Getty Images

The world's largest retailer is showing it may not be all doom and gloom for the retail industry.

Wal-Mart topped earnings estimates on Tuesday, driven by better-than-expected U.S. sales both in stores and online. Comparable sales in the company's U.S. stores grew 1.8 percent, marking the retail giant's tenth consecutive quarter of growth. On Wednesday, the stock was trading slightly higher.

And good news for Wal-Mart could spill over to the rest of the retail industry.

Using hedge fund analytics tool Kensho, CNBC conducted a study to find out which retailers tend to fare best after the mega-merchant tops earnings expectations.

Here's what we found:

Over the past five years, when Wal-Mart tops forecasts by 1 cent per share or more, the company tends to trade positively a week later, up 55 percent of the time, with an average return of 2.3 percent. Compare that to the S&P 500, which is higher three-quarters of the time, gaining an average of 0.9 percent.

But if you want to top those gains, history points to Dollar Tree and Amazon — each trading higher 73 percent of the time.

Dollar Tree logs the best average return, up an average of 4.3 percent, while Amazon is higher on average by 2.4 percent.

But if you're willing to trade average return for consistency, take a look at the SPDR S&P Retail ETF, which according to Kensho has traded positively 91 percent of the time with an average return of 1.7 percent.

Ross Stores and TJX Companies are also consistently positive, both trading higher 82 percent of the time, with an average return of 2 percent and 1.8 percent respectively.

Disclosure: CNBC parent NBC Universal is a minority investor in Kensho