Walmart on Thursday reported quarterly earnings and sales that topped analysts' expectations, as more shoppers flocked to its stores and spent more per trip, and e-commerce sales ticked higher than previous quarters.

The retailer said it had the strongest growth in more than a decade at those stores open for at least 12 months, thanks to robust sales in its grocery and apparel departments, both of which Walmart has poured money into to compete with the likes of Amazon and Kroger.

Walmart shares closed the day up 9.3 percent on the news, the most gains since Nov. 16, 2017, when the stock climbed 10.9 percent.

Here's what the company reported compared with what analysts were expecting, based on a survey by Thomson Reuters:



* Adjusted earnings per share: $1.29 vs. $1.22 expected

* Revenue: $128.03 billion vs. $125.97 billion expected

* Same-store sales in the U.S.: an increase of 4.5 percent vs. an increase of 2.4 percent expected

Walmart said U.S. online sales climbed 40 percent during the quarter — a sign that changes like a new website redesign and grocery delivery options are paying off — and the company is still anticipating an increase of 40 percent for the full year. In prior quarters, Walmart's digital sales growth had moderated somewhat from a 50 percent jump logged in the third quarter of last year.

On a call with members of the media Thursday morning, the head of Walmart's U.S. e-commerce business, Marc Lore, said brands are now more interested in selling on Walmart.com, now that the website is easier for shoppers to navigate and has localized touches. Partnering with new brands takes time, Lore said, but the company is already seeing heightened traffic to certain parts of Walmart.com.

Walmart has been focused on bulking up its online platform to compete with its biggest rival, Amazon. It recently redesigned its website, purchased the biggest e-commerce player in India — Flipkart — and struck a partnership with Lord & Taylor that brings new merchandise to Walmart.com. The retailer is also investing heavily to add more delivery options for shoppers. But all this activity means Walmart's profit margins have taken a hit as expenses ramp up, and in recent quarters the stock has traded off because of that.

The company also benefited during the quarter as a cool April turned into a warmer May and shifted sales of items like air conditioners, swimwear and gardening supplies later into the year.



Building on the momentum and anticipated retail sales growth in the U.S., Walmart raised its sales and earnings outlook for the full year, excluding any impact from its acquisition of Indian e-commerce company Flipkart, which is still in the process of closing.

"We're pleased with how customers are responding to the way we're leveraging stores and e-commerce to make shopping faster and more convenient," CEO Doug McMillon said in a statement. "Customers tell us that they feel better about the current health of the U.S. economy as well as their personal finances. They're more confident about their employment opportunities."



Walmart reported a net loss for the quarter ended July 31 of $861 million, or 29 cents a share, compared with net income of $2.9 billion, or 96 cents a share, a year ago. Excluding one-time items such as a loss related to the sale of a majority stake in Walmart Brazil, Walmart earned $1.29 per share, 7 cents ahead of analysts' expectations.

Revenue climbed 3.8 percent to $128.03 billion from a year ago, surpassing expectations for $125.97 billion.

Same-store sales in the U.S. rose 4.5 percent, again better than the expected 2.4 percent increase.

Like many retailers today, Walmart is facing higher transportation costs because of rising fuel and a shortage of truck drivers in the U.S. There's also some uncertainty around the prospect of additional tariffs implemented by President Donald Trump's administration, which could result in Walmart passing on some of those price increases to consumers.

"While we know questions persist about tariffs, the potential future impact is difficult to quantify," CFO Brett Biggs said in a statement. "We are closely monitoring the tariff discussions and are actively working on mitigation strategies, particularly in light of potentially escalating duties."

Looking to the full year, Walmart now expects to earn between $4.90 and $5.05 per share, up from a prior range of $4.75 to $5 and excluding any impact from its pending acquisition of Flipkart. The retailer said same-store sales in the U.S. should rise about 3 percent in fiscal 2019, up from a prior target of at least 2 percent.

Walmart shares are up more than 20 percent from a year ago, bringing the retailer's market cap to $291 billion roughly. For comparison, Amazon's stock has climbed more than 90 percent over the period, and the e-commerce giant has a market cap of nearly $920 billion.

— CNBC's Chris Hayes contributed to this reporting.