Walmart on Thursday reported second-quarter earnings that topped expectations and raised its outlook for the full year, building on the momentum in its core U.S. business, online operations and investments in grocery.It marked the 20th consecutive quarter of sales gains in the U.S. for Walmart and its 19th quarter of traffic growth on its home turf.Walmart shares jumped 5% in early trading on the news.Here’s what Walmart reported for the quarter ended July 31 compared with what analysts were expecting, based on Refinitiv data:* Earnings per share, adjusted: $1.27 vs. $1.22 expected* Revenue: $130.38 vs. $130.11 billion expected* Same-store sales: up 2.8% vs. 2.1% expected”Customers are responding to the improvements we’re making, the productivity loop is working, and we’re gaining market share,” CEO Doug McMillon said in a statement.Net income rose to $3.61 billion, or $1.26 per share, compared with a net loss of $861 million, or 29 cents a share, a year earlier. Excluding one-time items, Walmart earned $1.27 a share, 5 cents better than expectations.Total revenues grew 1.8% to $130.38 billion from $128.03 billion a year earlier, beating expectations for sales of $130.11 billion.In the U.S., net sales grew 2.9% to $85.20 billion from $82.82 billion a year earlier.Sales at Walmart stores in the U.S. open for at least 12 months and its website were up 2.8%, excluding fuel, beating expectations for growth of 2.1%. Walmart said transactions were up 0.6% during the quarter, compared with a 2.7% increase a year ago. The average ticket was up 2.2%, better than a 1.8% increase a year ago.Walmart is expected to have seen a boost this quarter thanks to Amazon’s 48-hour Prime Day event earlier in July, when Walmart offered similar deals to compete. Gordon Haskett analyst Chuck Grom estimated that during the event Walmart saw about 14% of the visits that Amazon did.Walmart said e-commerce sales surged 37% during the quarter, matching growth during the prior quarter. And the company is still calling for U.S. e-commerce sales growth of 35% for the year, which would be slightly less than what it logged in fiscal 2019.The company said its online business has seen a boost thanks to its gradual rollout of next-day delivery across the country, which now reaches about 75% of the U.S. population. It said more than 2,700 stores now offer pickup for online grocery orders. And more than 1,100 locations offer same-day delivery for groceries.For fiscal 2020, it’s now calling for adjusted earnings per share to range between a slight decrease to a slight increase, compared with a prior forecast that was calling for a low-single-digit percentage decline. And it said same-store sales in the U.S. should fall toward the upper end of a prior range of 2.5% to 3% growth.Analysts had been calling for Walmart’s fiscal 2020 earnings to be down 1.6% from the prior year.Additional tariffs on consumer goods set to take effect later this year remain a headache for Walmart, the largest retailer in the world.Earlier this week, some of the consumer goods expected to be impacted by 10% tariffs on Sept. 1 were delayed until Dec. 15. Walmart already warned earlier this year that increased tariffs would lead to increased prices for customers. The company sources about two-thirds of its goods domestically, largely because of its massive food business. The remaining one-third of items comes from overseas, including from China.CFO Brett Biggs told CNBC Walmart’s updated earnings outlook reflects the retailer’s current understanding of the tariffs situation as of Tuesday. He added that Walmart is “hopeful for a long-term agreement” between the U.S. and China and that the company has “thoughtfully managed through pricing and margins, working to find a nice balance between our customers and shareholders.”Walmart’s earnings report also comes amid broader turmoil in the market.Stocks plunged on Wednesday, with the Dow Jones Industrial Average logging its worst performance of the year after the bond market flashed a troubling signal about the U.S. economy. Retail stocks overall were spooked by a dismal earnings report from Macy’s that suggested conditions were worse for department stores than originally suspected.”We believe value-orientated … retailers Walmart and Target are better positioned to capture share as shopper trends evolve,” Cowen & Co. analyst Oliver Chen said in a note ahead of earnings. “Meanwhile, department store players are getting squeezed and are working to quickly adapt to changing shopper preferences as physical traffic continues to decline.”Walmart shares, valued at $305.5 billion, have been more resilient. The stock has gained nearly 20% this year. The S&P 500 Retail ETF (XRT) is down a little more than 6%.