Investors had some significant worries about Walmart's (NYSE:WMT) business trends heading into its second-quarter earnings report. Its sales growth was underwhelming at its last quarterly outing, for one, and the company had also endured a discouraging slowdown in its e-commerce channel.

But in its latest earnings announcement, the retailing titan put those two shareholder concerns to rest by posting some of its strongest growth in years. At the same time, Walmart lifted its outlook for the year on the top and bottom lines.

More on that rising forecast in a moment. First, here's how the latest results compare to the prior-year period.

Metric

Q2 2018

Q2 2017

Change (YOY)

Revenue

$128 billion

$123 billion

4%

Net income

($861 million)

$2.9 billion

N/A

Earnings per share

($0.29)

$0.96

N/A

Data source: Walmart's financial filings. YOY = year over year.

What happened with Walmart this quarter?

Sales growth accelerated meaningfully in the core U.S. business thanks to a healthy spike in both customer traffic and average spending per visit. Walmart's profitability continued inching lower, but management expressed confidence that this trend will improve as the e-commerce business matures.

Man and a woman shopping in the TV section of a store

Image source: Getty Images.

Highlights of the quarter included:

  • Comparable-store sales gains shot up to 4.5% from 2% in the prior quarter. That boost marked the best quarterly increase in over a decade and was powered by a 2.2% jump in customer traffic and 2.3% higher spending.
  • The fresh food aisles were a bright spot, and so were seasonal merchandise departments that benefited from a delayed start to spring.
  • E-commerce sales growth accelerated to 40% from 33% to stay right on pace with management's aggressive full-year target.
  • The Sam's Club segment saw revenue spike 6.5%, its best result in six years, after adjusting for fuel and tobacco sales.
  • Gross profit margin dropped slightly thanks to price cuts and higher transportation costs.
  • Operating income edged down 4% but Walmart reported an overall loss powered by a $4.8 billion loss from the sale of its Brazil partnership.
  • Inventory levels dropped, putting the retailer in a strong position heading into the holiday shopping season.

What management had to say

"We had a great quarter with strong results and momentum across the business," CEO Dough McMillon said in a press release. In prepared remarks, executives highlighted successes in the physical stores, where upgrades to the fresh food section led to the best grocery growth in nine years.

They were also happy with improvements to the online shopping channel, including home delivery, order pick up functionality, and increased assortment on the website. "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," McMillon said. 

Looking forward

Walmart issued a new outlook for the fiscal year that reflects the improving sales trends and the clearer profit picture as we head into the holiday selling crush. Comparable-store sales are now expected to rise by 3% in both the core U.S. business and Sam's Club. Those forecasts had stood at 2% and negative 1%, respectively.

McMillon and his team still believe the e-commerce business will grow at a 40% rate, but they're now calling for better core profitability as operating margin holds steady rather than declining by a few percentage points.

Those gains will be overwhelmed this year by losses Walmart is taking on some of its prior capital investments. However, excluding those hits, adjusted earnings are now on track to reach between $4.90 per share and $5.05 per share, up from the prior target range of $4.75 per share to $5 per share.

Demitrios Kalogeropoulos has no position in any of the stocks mentioned. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.