Wal-Mart's U.S. business accelerated during its fiscal fourth quarter, helping the world's largest retailer top Wall Street's earnings expectations and record its largest domestic same-store sales increase since July 2012.
Still, even as the company reported its 10th straight quarter of comparable sales growth, revenue fell short of expectations as foreign exchange rates and food deflation weighed on its top line.
Wal-Mart's shares shook off that miss and moved 2 percent higher in premarket trading.
Here's how Wal-Mart did:
"We've been waiting a long time for Wal-Mart to show these kinds of numbers. We like what we're seeing here. They're doing all the right things," Jan Kniffen, CEO of J.Kniffen Worldwide Enterprises, told CNBC.
Wal-Mart has been investing heavily in both its stores and e-commerce operations, which have weighed on its profitability. Last year, Wal-Mart earned $1.49 per share.
But those investments have paid off for its U.S. business, which recorded its ninth straight increase in quarterly traffic. The retailer's total sales also edged 1 percent higher from $129.67 billion a year ago.
Apparel, health and wellness, and grocery were some of the top-performing categories at the company's U.S. stores, despite a slow start to the quarter for cold-weather merchandise. Electronics, media and gaming were soft.
Wal-Mart's online sales also accelerated, boosted by its acquisition of Jet.com and the continued rollout of its online grocery service. U.S. digital sales rose 29 percent during the quarter. The company will no longer report an overarching global figure for its e-commerce growth in order to focus on the U.S. market. Its domestic online performance has been outpacing its results overseas.
"We continue to invest in e-commerce to accelerate growth," CEO Doug McMillon said in prepared remarks. "We're gaining traction and moving faster."
In a bid to better compete against Amazon, Wal-Mart has snapped up three online retailers over the past five months for a combined $3.12 billion. The largest of those acquisitions was its $3 billion purchase of Jet.com, which brought Jet Chief Marc Lore on board and led to a reshuffling of Wal-Mart's digital business.
Last month, Wal-Mart scrapped a subscription program it was testing, which offered free two-day shipping for $49 a year. Now, it will offer free shipping on more than 2 million items for no fee when shoppers spend at least $35. That's down from its previous $50 threshold.
Wal-Mart CFO Brett Biggs said the company's digital sales have improved since it implemented this change.
"They're competing with a really, really tough business in Amazon. So we kept waiting to see, could it really happen. It looks to me like it's happening," Kniffen said. "And of course, they've got strong cash flow. They can buy back stock. I mean, they're this really big, healthy company."
The company's gross margin decreased slightly, as part of its efforts to ensure it has the lowest prices. Markdowns after the holidays also weighed on Wal-Mart's gross margin.
Comparable sales at 10 of Wal-Mart's 11 international markets increased, though exchange rates pressured its top line.
Net sales in its international division grew 3 percent excluding currency fluctuations but declined 5.1 percent when including their impact. The U.K. continued to be Wal-Mart's weakest market, as it struggles to combat low-price competitors like Aldi.
Comparable sales at Sam's Club rose 2.4 percent excluding fuel.
For fiscal 2018, Wal-Mart expects to earn between $4.20 a share and $4.40 a share, compared with an estimate of $4.33. That includes profit of 90 cents per share to $1 per share in the first quarter. Sales have started the year slower than expected, due in part to a delay in tax refunds, Biggs said.
Wal-Mart said at its October investor day that it would significantly slow its pace of store openings in the fiscal year that just began. Instead, it will focus its capital expenditures on e-commerce, the company said at the time.
Wal-Mart has meanwhile been investing in its employees by raising their minimum pay and providing better training.
— CNBC's Elizabeth Gurdus contributed to this report