BENTONVILLE, Ark. — More customers are shopping for groceries in Walmart stores and online at Walmart.com. Executives of Walmart Inc. said an expanded online grocery offering is attracting new customers, and existing customers are adding more items to the shopping cart.

“It is the best performance we’ve seen in grocery in nine years, and it’s been across the box, so fresh has performed well whether it’s produce, bakery, meat,” said Greg Foran, president and CEO of Walmart US, during an Aug. 16 earnings call. “We are seeing good strength in frozen foods. We’re seeing good strength in grocery. And we continue to perform well with our private brands, whether that be the Marketside brand in fresh or Great Value or Sam’s Choice in dry. So, there is nothing that has stood out. It has been balanced ... we are getting some new customers, and we’re getting existing customers to put an extra item in. So, pretty balanced across the board.”

In the second quarter ended July 31, Walmart had a net loss of $861 million, which compared with net income of $2,899 million, or $0.96 per share, in the prior-year period. Revenues for the quarter totaled $128,028 million, up 3.8 percent from $123,355 million.

On an adjusted basis, earnings per share increased 19 percent to $1.29 from $1.08. Reported earnings were impacted by a charge related to the sale of a majority stake in Walmart Brazil, an adjustment to the provisional tax amount related to tax reform, and an unrealized loss on the company’s equity investment in JD.com.

Walmart US comparable sales, excluding fuel, increased 4.5 percent in the quarter, marking the strongest growth in more than 10 years, led in part by grocery performance. Traffic and ticket growth each exceeded 2 percent in the quarter.

“Fresh food category sales were strong and led to the best grocery comp in nine years,” said C. Douglas McMillon, president and CEO of Walmart, Inc. “Customers continue to gravitate toward our selection of fresh produce, meat, and bakery items that offer great quality at low prices.”

Expanded online assortment drove growth of Walmart US omni-channel. Grocery pickup is now offered in more than 1,800 locations, and the company said it is on track to reach about 40 percent of the population by year-end with grocery delivery, executives said.

“Grocery pickup wait times continue to come down and our grocery delivery times are improving,” McMillon said. “We’re continuing to innovate with trials of self-driving cars in Arizona for our grocery pickup customers and automated picking capabilities for grocery pickup in our store in Salem, New Hampshire. Overall, our omni-channel initiatives are contributing to comp sales growth and providing customers with new levels of shopping convenience.”

The company also is seeing improved trends in its Sam’s Club business in the United States, McMillon said, adding that fresh food continues to generate traffic for the brand.

“We had our best comp sales performance in six years,” he said.

For the first six months of the year, Walmart had net income of $1,273 million, equal to $0.43 per share on the common stock, which was down 79 percent from year-ago net income of $5,938 million, or $1.97 per share. Total revenues for the period advanced 4.1 percent to $250,718 million from $240,897 million.

Walmart’s positive performance may carry negative implications for some of its packaged food vendors, said research analysts at Credit Suisse in an Aug. 17 report. Robert Moskow and Neel Kulkarni of Credit Suisse noted in the report that Walmart’s continued emphasis of its private label strategy and price investments to drive growth, as well as initiatives around online grocery pickup and delivery that are contributing to share gains from smaller competitors, have improved the retailer’s negotiating power with big food processors.

“Given Walmart’s importance in food (about 20 percent to 30 percent of our group’s sales), we believe that the companies investing along with Walmart in innovation, promo spending and omni-channel support will return to top-line growth in the year ahead,” the analysts said in the report. “However, we expect the higher spending with Walmart and the pricing pressure to lead to another year of gross margin dilution.”

Additionally, the report identified “winners and losers” in the packaged food sector that may be affected by Walmart’s recent strategic initiatives.

“According to our Nielsen data, several food companies have generated strong growth over the past 12 weeks in the mass-heavy channel (Walmart 60 percent to 70 percent of total), including Mondelez, Conagra, Pinnacle, General Mills, and Kellogg,” the report said. “Consistent with our concerns, Kraft Heinz and Campbell’s sales have been declining in the channel. We are also concerned about Hershey, whose growth rate has stagnated.”