Retail is having its best holiday shopping season in six years, according to early data tracking consumers' purchases.

Sales in the U.S. from Nov. 1 through Christmas Eve were up 5.1 percent to more than $850 billion, according to Mastercard SpendingPulse, which monitors spending both in stores and online via all forms of payment. Mastercard also said online sales during that time frame were up 19.1 percent from a year ago, in line with earlier reports that showed robust growth in e-commerce this holiday season.

And this all comes amid the latest fluctuations in the stock market, worries on Wall Street about a potentially slowing economy and a partial government shutdown. Consumer confidence remains strong, translating into robust retail sales, said Steve Sadove, former CEO of Saks and currently advisor for Mastercard.

Over the past few weeks, "many retailers were able to give consumers what they wanted," he added.

Some of the strongest sectors within retail this holiday season include apparel and home improvement, according to Mastercard. Apparel sales were up nearly 8 percent from Nov. 1 through Dec. 24, their best growth since 2010, the firm said. Home improvement spending, meanwhile, was up 9 percent.

Clothing retailers like Lululemon, Abercrombie & Fitch and Old Navy had already kicked off the holiday shopping season on a high note, seeing strong sales during Black Friday weekend. Analysts say companies that sell apparel have done a better job in 2018 managing inventory and keeping product assortments fresh, but there are still going to be "losers" in the space.

"Not all apparel is doing great," Craig Johnson, president of retail advisory firm Customer Growth Partners, told CNBC. The biggest growth over the past few months has stemmed from activewear retailers like Nike and off-price companies like T.J. Maxx, he said.

Some of those stocks were soaring Wednesday, on the heels of the Mastercard data being released. Abercrombie shares were up 6 percent, while Ross Stores gained nearly 6 percent and Burlington Stores rose 4 percent. Kohl's stock jumped nearly 7 percent, while Lululemon shares were up more than 4 percent, and Macy's was up a little more than 5 percent.

The S&P 500 Retail ETF (XRT) was up more than 3 percent, on pace to break a four-day losing streak and on track to mark its best daily performance since March 26, when the ETF gained 3.17 percent.