NEW YORK (AP) — 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 Jet.com 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.

"Walmart's online performance continues to validate its substantial investments in this critical channel, including its purchase of Jet.com," 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 past 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.

Best Buy is also facing the challenge from Amazon's expansion of services and products.

"As we head into the teeth of the holiday shopping season, the key for Best Buy to maximize its profitability and therefore success will be how well it manages its promotional cadence as Walmart and Amazon continue their heavyweight battle for market share across many categories," O'Shea said.

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 also testing store-curb pickup for online grocery orders at 50 stores in the Minneapolis area, but it's playing catch-up.

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

"Curiosity, creativity, decisiveness and speed are priorities," Doug McMillon, Walmart's CEO, said in a prerecorded statement.

For the holiday shopping season, Walmart wants to keep that momentum going. It's hoping to tempt shoppers with online deals before Black Friday, and started some online deals a week ago.

The Bentonville, Arkansas-based company earned $1.75 billion, or 58 cents per share, in the third quarter. Earnings adjusted to extinguish debt and for non-recurring costs came to $1 per share, beating the average estimate of 97 cents per share, according to Zacks Investment Research.

Walmart now expects full-year earnings of $4.38 to $4.46 per share, up from a forecast for $4.30 to $4.40 per share.

Shares in Wal-Mart Stores Inc. rose almost 11 percent, or $9.79, to close Thursday at $99.62.

_____

Elements of this story were generated by Automated Insights (http://automatedinsights.com/ap) using data from Zacks Investment Research. Access a Zacks stock report on WMT at https://www.zacks.com/ap/WMT