Americans are in shop-til-you-drop mode, buoyed by a series of economic tailwinds that are yielding dividends for retailers. With a rising tide lifting much of the sector, analysts say that retailers who won’t, or can’t, invest in their business will miss out on the spoils.

“We’re still in a world of the haves and have-nots when it comes to retailers,” said Charlie O’Shea, lead retail analyst for Moody’s Investors Service. “Retail remains virtually a zero-sum game.”

O’Shea predicted that the divide between poorly performing retailers and better ones will become more pronounced by the end of the year. “I think there are a lot of tailwinds right now for the consumer… but the question becomes, where are those people going to spend?”

“I think some of that shakeout has been good for the remaining retailers,” said Liz Dunn, CEO of retail analytics firm Pro4ma.

This certainly was the case for Walmart, which beat analyst estimates when it announced earnings on Thursday, earnings that were the strongest in a decade for same-store sales.

Broader measures of discretionary consumer spending also are encouraging. The Commerce Department Wednesday said that retail sales rose 0.5 percent last month, higher than the 0.1 percent analysts anticipated. The National Retail Federation increased its prediction for retail sales growth from a range of 3.8 to 4.4 percent to a minimum of 4.5 percent, based on a 4.8 percent jump in the first half of the year

“We have this really good environment, which is underpinned by low unemployment as well as a multiyear wealth effect from good momentum in the stock market,” said Oliver Chen, managing director and senior research analyst for the retail and luxury sectors at Cowen and Company.

This still hasn’t been enough to propel mid-market department stores out of the doldrums. JC Penney reported on Thursday losses of 38 cents a share, more than six times higher than the six-cent loss analysts had been expecting. And although Macy’s turned in quarterly sales and earnings that topped analyst expectations on Wednesday, the stock fell on the news — evidence, analysts said, of the ongoing challenges these stores face.

“I think department stores are going through an evolution about where they fit into consumer shopping behavior,” Dunn said.

“Even though we have a great economy, we have a customer who’s highly highly focused on value,” Chen said.

This has buoyed sales at retailers like Walmart, even though how Americans define “value” has shifted to include an assessment of quality as well as price. Shoppers today display a greater willingness to spend more at higher-end stores or brands, said Lindsey Bell, an investment strategist at CFRA Research.

“You’re seeing them trade up to national brands instead of buying the private labels,” she said.

Although private-label goods tend to deliver higher profit margins, stores benefit from the higher prices they can charge for name-brand goods. “That higher topline should help offset any margin erosion from them trading up,” Bell said.