A day after Target leaders declared the Minneapolis retailer would take a cautious business approach as it faces a less-compulsive consumer, megaretailer Walmart upped its outlook for the year Thursday after reporting higher sales than financial experts expected.

The key to Walmart's confidence even as other retailers like Target are reporting a slowdown: groceries.

"I would say that Walmart's grocery section has really driven those revenue numbers up and they have a lot more to work with. ... I think in grocery, Walmart is absolutely winning," said Liza Amlani, a retail merchandising expert and founder of the Retail Strategy Group.

On Thursday, Walmart reported its U.S. comparable sales — or sales from stores open for the past year — were up 7.4% in February, March and April compared to the same time last year. Its global revenue of $152.3 billion beat Wall Street expectations. After the positive first quarter, company leaders forecast its net sales would increase about 3.5% this fiscal year, a rosier forecast than the 2.5% to 3% they predicted at the beginning of the year.

In contrast, Target Corp. took a more conservative approach as it saw sales begin to sour later in the first quarter. Target's comparable sales plateaued last quarter vs. last year, something that hasn't happened in six years for the retailer, mainly thanks to a decrease in digital sales. Yet its total revenue of $25.3 billion for this past quarter were in line with predictions, and its adjusted earnings per share came in at $2.05, better than the $1.76 analysts estimated.

Still, Target leaders predicted comparable sales in the second quarter will experience a low-single-digit decline, and full-year sales would dip or perhaps achieve a low-single-digit increase.

The big differentiator between Walmart and Target's comparable sales performance and subsequent different takes on the remainder of the year is how many consumers have turned to Walmart for groceries as they have tried to save money while shopping for essentials.

Walmart reported its U.S. stores this past quarter gained market share in grocery, including with higher-income households.

The enormity of Walmart's grocery selection — which has continued to expand — and the large number of Walmart's retail stores puts it on a different scale in grocery that Target can't compete with just based on sheer size, Amlani said.

"There was a stigma associated with shopping at Walmart ... across [consumer-packaged goods] and even apparel," she said. But "more so now than I have ever seen, I think there's more of an acceptance of shopping around for the best price."

That doesn't mean Target hasn't worked to evolve its food offerings and gained grocery customers. Good & Gather, which Target introduced in 2019, has grown to be Target's largest owned brand, generating more than $3 billion in sales last year. More than half of Good & Gather products sell for under $5.

"When I arrived at Target just under nine years ago, our food and beverage category was underperforming and losing market share," said Target CEO Brian Cornell in a Wednesday call with analysts. "But rather than turning away from that part of our business, we decided to lean in."

Both Target and Walmart have seen more growth in essentials while customers have been more reluctant to buy discretionary products such as general merchandise and apparel. Those categories have lagged since the end of the pandemic.

The softness in discretionary items is an issue for both companies, as those products provide better profit margins than groceries.

Target is more dependent on discretionary products, but in many ways, Target has also mastered the art of helping customers find deals with its private label brands, Amlani said.

Target's owned-brand strategy is something Walmart and other retailers haven't been able to match, Amlani said, and gives the Minneapolis retailer the edge in other categories like baby and children's apparel, seasonal goods and home decor.