Walmart (NYSE:WMT) reported its fiscal second-quarter earnings before the market opened Thursday. The company delivered stronger-than-expected results, driven by robust comparable-store sales and continued growth from digital and omnichannel initiatives.

The strong results continue a trend that began last year and into the first quarter of 2019.

Let's look at the metrics that boosted the results and sent the stock surging as much as 6% early in the day before leveling off at a 4% gain. Here are five takeaways from Walmart's solid earnings report.

A Walmart store, showing the logo on the front of the building

Image source: Walmart.

1. Continued strong sales growth

For the quarter ending July 26, Walmart delivered revenue of $130.4 billion, up about 1.8% year over year. This edged out analysts' consensus estimates of $130.11 billion. When excluding the headwinds from unfavorable foreign currency exchange rates, the results would have been even stronger, with revenue of $131.7 billion, up 2.9%.

Net sales at U.S. stores increased 2.9%, while sales at international locations declined by 1.1%. Excluding the impact of negative foreign currency headwinds, international sales actually improved, increasing 3.3% in constant currency.

2. Comps are improving

Comparable-store sales in the U.S. helped drive the gains, increasing 2.8% year over year, marking Walmart's 20th consecutive quarter of positive comps. On a two-year stacked basis, comps accelerated sequentially to 7.3%, marking the company's strongest growth in more than a decade.

The improving comparables were driven by comp transactions that increased 0.6% and comp tickets that grew by 2.2%.

3. Continued investment hits the bottom line

Walmart reported operating income of $5.6 billion, down 2.9% year over year, resulting in adjusted earnings per share of $1.27. That was down slightly from the $1.29 it delivered last year but easily surpassed expectations of $1.22. Adjusted earnings per share excludes an unrealized loss of $0.01 related to Walmart's stake in Chinese e-commerce provider JD.com (NASDAQ:JD).

The company continues to invest in a number of areas that are a drag on profits but are expected to drive future gains. This includes the build-out of its grocery pickup locations (which now total 2,700) and more than 1,100 delivery locations at its U.S. stores. Walmart's NextDay delivery service now reaches about 75% of the country.

Walmart employees filling baskets from shelves at one of its fulfillment centers.

Image source: Walmart.

4. E-commerce continued to drive the gains

Walmart reported e-commerce sales that increased 37% year over year, driven higher by gains in online grocery sales. The segment also got a boost from increasing sales of higher-margin categories like home and apparel. E-commerce sales at Sam's Club also shined, up 35% compared to the prior-year quarter.

The company is focusing on a number of factors to grow its digital sales, including on-time delivery and improving its net promoter score. This resulted in an increasing number of monthly active users, though Walmart hasn't yet revealed specific numbers.

5. Boosting full-year guidance

In the wake of its better-than-expected quarter, management is raising its guidance for the year. Walmart now expects comp sales growth near the high end of its previous range of 2.5% to 3%.

The company is also forecasting a slight decrease to a slight increase year over year in both operating income and adjusted earnings per share, an improvement from the single-digit-percentage decline it previously anticipated. These improved results include Flipkart, the e-commerce provider in India it acquired last year.