FILE - In this Thursday, June 1, 2017, file photo, customers walk out of a Walmart store in Hialeah Gardens, Fla. Wal-Mart Stores Inc. reports earnings, Thursday, Nov. 16, 2017. (AP Photo/Alan Diaz, File)

NEW YORK — A surging online business and strong food sales boosted Walmart's results Thursday ahead of the holiday season, a day after its rival Target offered a cautious forecast that overshadowed progress it has made in bringing more customers to its stores.

And Best Buy, the nation's largest consumer electronics chain, reported a boost in third-quarter profit and sales, but its results and outlook fell short of Wall Street expectations. The chain cited severe hurricanes in the U.S. South and a later unveiling of the new iPhone X.

Still, the big-box stores fared well overall, at least temporarily allaying fears that Amazon is a death knell for this sector. With consumer spending solid and unemployment low, the National Retail Federation trade group expects holiday sales to at least match the 3.6 percent growth of a year ago. Analysts at Bain & Co. expect Amazon to capture about half of the total growth this holiday season, pushing retailers to spend heavily at its stores and online.

But Walmart's huge investments in its online business and its fleet have helped to put distance between itself and other traditional retailers. Since buying for more than $3 billion last year, Walmart has added online services, acquired brands like Bonobos and ModCloth and vastly expanded the number of items on its site.

some text
FILE - This Wednesday, Feb. 8, 2017, file photo shows Walmart signage at one of the company's neighborhood markets in Hialeah, Fla. Wal-Mart Stores, Inc. reports earnings, Thursday, Nov. 16, 2017. (AP Photo/Alan Diaz, File)

"Walmart's online performance continues to validate its substantial investments in this critical channel, including its purchase of," Moody's lead retail analyst Charlie O'Shea said in a note.

E-commerce sales grew 50 percent, though Walmart has a long way to get even close to Amazon's dominance online. Walmart said in October that U.S. e-commerce sales should be about $11.5 billion this year and it expects global e-commerce to be $17.5 billion. That's still less than 4 percent of overall sales. That compares with Amazon's $94.66 billion in the last calendar year.

Amazon has been building its network of services too, using its $99-a-year Prime membership with same-day and even one-hour shipping options to develop loyalty. And Amazon's purchase of Whole Foods Market this summer has raised the competitive stakes in the food business.

Walmart says its food business, critical to drawing shoppers into its stores, had the strongest quarterly performance in nearly six years.

Overall, Walmart posted quarterly revenue of $123.18 billion, surpassing Wall Street forecasts of $121.05 billion. Sales at stores open at least a year rose 2.7 percent for the U.S. division, the biggest gain since the first quarter of 2009. Customer counts rose 1.5 percent, and Walmart said shoppers added one extra item to their cart, which helped boost sales.

The company has been aggressively cutting prices and has overhauled its shipping strategy and is planning to double the number of store-curb pickup for groceries ordered online to 2,000 by next year. Rival Target is testing store-curb pickup for online grocery orders at 50 stores.

Walmart also has aligned with Google on voice shopping, as it tries to chip away the dominance of Amazon's Alexa-powered Echo devices.