Walmart reported third-quarter earnings and revenue that narrowly topped estimates and raised its full-year outlook. The retailer cited strong e-commerce growth ahead of the holiday season.

Global e-commerce sales grew 17%, driven by store-fulfilled pickup and delivery. Walmart U.S. e-commerce sales rose 23%, and Sam's Club U.S. rose 30%. Walmart U.S. advertising sales increased 37% for the quarter.

Walmart said it rolled back prices on nearly 8,000 products across its stores. The company framed the move as a response to U.S. consumers worried about the cost of living, including elevated food and gas prices.

CEO John Furner told CNBC's Becky Quick that Walmart has seen higher-than-expected diesel costs. He said tariff refunds have helped offset those costs and keep prices low. "The reality is that increases in diesel fuel and transportation, they do work their way into cost of goods," Furner said. "So we're hoping to see these costs come down as soon as possible, and we'll keep prices as low as we can."

CFO John David Rainey told CNBC that online order growth was driven by an emphasis on delivery speed and reduced prices. He said Walmart saw its largest share gains in the food category in three years during the quarter. "This was another really solid quarter for us, we feel good about it," Rainey said.

Walmart now expects net sales to rise between 4.9% and 5.2%, up from its prior forecast of 4% to 5%. It expects adjusted earnings per share between $2.84 and $2.89, compared with a prior range of $2.80 to $2.87. Adjusted operating income is now projected to grow between 8% and 8.6%, up from the earlier range of 7% to 8.5%.

For the quarter ended Oct. 31, Walmart reported net income of $4.95 billion, or 62 cents per share, down from $6.14 billion, or 77 cents per share, a year earlier. Revenue rose 5.2%. Walmart U.S. net sales reached $125 billion, up 3.6%. Sam's Club reported net sales of $25.9 billion, a 10% increase.

Furner said the company's AI agent, Sparky, has seen encouraging adoption and has led to customer basket increases of 40% on average.

Walmart launched a joint membership option with Walmart+ and Sam's Club in October. Furner said it has brought roughly two million new people into Sam's Club since late October. Rainey said consumers are "spending appreciably more." Global membership fee revenue grew 17% in the quarter.

Rainey said he is "optimistic" about consumer spending heading into the holiday season and that the fourth quarter is "off to a pretty good start."