Amazon.com reported a record-breaking holiday season as shoppers loaded their online baskets with items from Echo speakers to Calvin Klein clothes, suggesting consumer optimism isn’t being deterred by a tumbling stock market.

The internet retailer said that tens of millions of people worldwide signed up for its Prime service, which offers free two-day shipping on millions of items as well as video and music streaming. In the United States alone, more than 1 billion items were shipped for free using Prime, Amazon said Wednesday.

Americans are benefiting from higher employment and wages, fueling higher household cash flow, which contributed to a blow-out Christmas buying spree. Shoppers seemed to be merry despite a S&P 500 index that has tumbled, a government shutdown that’s entering its fifth day and the trade tensions with China.

Amazon wasn’t the only one benefiting from an insatiable consumer appetite. Mastercard and Visa rebounded after four days of declines. Mastercard said holiday sales increased 5.1 percent to more than $850 billion this year, the strongest growth in the past six years. Online shopping saw gains of 19 percent compared with 2017, according to Mastercard SpendingPulse. Brick-and-mortar retailers also gained. Nike, Macy’s and Kohl’s all posted gains.

Compared with last year, people bought millions more of Amazon’s devices, including the new Echo Dot speaker and the Fire TV Stick, the Seattle company said. At the same time, Amazon said that more than 50 percent of items sold in its stores came from small and medium-size businesses.

Among the most popular items under the Christmas tree were the L.O.L. Surprise Glam Glitter Series doll, Bose wireless headphones and clothes from Carhartt. Other popular brands bought through Amazon’s Prime Wardrobe service, which allows consumers to fill a box with selected items and return anything that they don’t want, included Calvin Klein and Champion.

MBA BY THE BAY: See how an MBA could change your life with SFGATE's interactive directory of Bay Area programs.

Amazon started the shopping frenzy strong, with November’s Cyber Monday already pegged as the company’s biggest shopping day in history. Along with the Christmas sales report, the picture seems much brighter than Amazon had projected in its latest earnings results. In October, Amazon’s revenue and profit forecast for the holiday quarter fell short of analysts’ estimates, as investors worried about the online retailer’s increased pace of spending.

While Amazon has expanded into almost every area of retail, from pharmaceuticals to groceries, its more profitable units are cloud computing and advertising. Still, Amazon, which dominates e-commerce in the United States, has relied on the growth of the number of Prime members, who pay $119 a year for the service. Recent estimates put U.S. subscribers at just under 100 million. Amazon didn’t give any new numbers for Prime subscribers, but said millions of unique items had shipped nationwide with Prime.

That kind of volume presents a challenge for logistics services like FedEx and United Parcel Service. In 2013, a larger-than-expected surge in last-minute online shopping caught UPS off guard and forced it and Amazon and other retailers to offer refunds to customers who didn’t receive their orders on time for Christmas.

This year, UPS said it expected to deliver an average of more than 31 million parcels a day during the holidays, and it anticipated its peak-season total to be 5 percent above last year’s tally. To deal with the rush of deliveries, the company invested in automation and new facilities to add sorting capacity of 350,000 packages an hour to its system.

“We’re so far pleased with the operational aspect of it,” said Glenn Zaccara, a spokesman for UPS. “The investments that UPS made in the network, technology, people and planning across the season with our customers obviously paid off.”

The couriers are bracing for a second wave of business as people begin returning gifts in January. UPS expects return packages to hit 1.3 million on Jan. 3. The company said it had 1.5 million returns, its highest for the season, on Dec. 19.

As the S&P 500 teetered on a bear market after a volatile fourth quarter and the worst December in more than a decade, Baird analyst Colin Sebastian listed Amazon as one of the three best picks for investors in the event of a market rebound. Amazon shares soared along with the broader markets Wednesday, rising nearly 9.5 percent to $1,470.90. They have gained about 17 percent this year, compared with an 12 percent decline on the S&P 500.

If Amazon’s Echo speaker was one of its best sellers, it appears to also have been a victim of its own success. Powered by Alexa, the voice-activated software, the smart devices appeared overwhelmed by an onslaught of new users on Christmas, according to reports from the United Kingdom. Owners asking Alexa to play music, turn on the tree lights or recite turkey recipes were often met with the response of: “Sorry, I’m having trouble understanding you right now,” the Guardian reported.

A week before Christmas, several of Amazon’s online stores in North America and Europe sold out of various models of Alexa-powered devices, hinting at the rise in demand.

Molly Schuetz is a Bloomberg writer. Email: mschuetz9@bloomberg.net