Walmart sales growth was the best in a decade

So much for all those worries that Walmart was losing ground to Amazon.

Walmart delivered its best US sales growth in more than a decade, and digital sales surged 40%.

Some analysts were worried that growth in Walmart's numerous digital operations, including Jet, ModCloth and Moosejaw as well as Walmart.com, were starting to slow.

But a stellar earnings report Thursday may put those fears to rest. Moody's lead retail analyst Charlie O'Shea called it "a banner quarter on multiple fronts."

Overall sales at US stores open at least a year rose 4.5%. Walmart also raised its outlook for the year.

The stock soared 9%, helping the Dow to a gain of almost 400 points, its best showing in four months.

Walmart's Sam's Club warehouse unit, a competitor of Costco and BJ's Wholesale, reported same-store sales growth of 5%, the best in six years.

And Walmart reasserted itself as a leader in the supermarket business. It has battled for market share with Amazon and its Whole Foods unit, as well as supermarket leader Kroger.

But Walmart's grocery sales growth was one of the highlights in the quarter. Walmart CEO Doug McMillon vowed that Walmart will continue to "aggressively roll out grocery pickup and delivery in the US."

Moody's O'Shea liked that news, too. He said Walmart's food business "continues as a bright spot, with rapid rollout of in-store pickup well underway, and product delivery expanding as well."

Walmart's results may also help reassure investors after disappointing sales from Macy's on Wednesday led to a retail sector bloodbath. Many prominent retail stocks plummeted more than 10%.

Shares of Target rose Thursday morning. Costco was higher, too.

But not all retailers rebounded. Shares of Nordstrom, the high-end department store chain which will report earnings after the closing bell Thursday, fell 2%.

And JCPenney shares plunged 25% to below $2 a share after the struggling department store company reported a bigger than expected loss and yet another steep decline in sales.