The U.S. Department of Commerce confirmed on Friday what retailers have been hinting at since Christmas –  that the holiday season gave them a much-needed lift, fueled by strong demand for home goods and electronics, and a surge in online purchases.

December retail sales — a measure of consumer spending at stores, restaurants and websites – rose 4.2 percent, the most in three years, the Commerce report concluded, while e-commerce sales rose 1.2 percent from November and 12.7 percent from the prior December.

Overall December sales – including automobiles, gasoline and restaurants – were up 5.5 percent from December 2016. It marked the fourth consecutive month of increase for the industry after a bruising year strewn with bankruptcies and department store closures largely from the shift to online shopping.

December's retail sales growth shows "the dire predictions of the demise of retail are premature," Moody's vice president Mickey Chadha said. "Consumers are still buying, but where they are buying and how they are buying is changing and will continue to evolve as price transparency increases and e-commerce and brick-and-mortar operations of retailers continue to converge into one seamless consumer experience."

Holiday sales from Nov. 1 through Dec. 31 rose 5.5 percent over the same period in 2016, to $691.9 billion. The number, which excludes restaurants, automobile dealers, and gasoline stations, includes $138.4 billion in online and other nonstore sales, which rose 11.5 percent over the year before.

GlobalData Retail managing director Neil Saunders cited these factors: Consumer confidence at 17-year highs, steady wage growth of about 3 percent, the booming stock market, and the robust housing sector.

These categories reported upticks from December 2016:

  • Building materials and supplies stores were up 8.1 percent.
  • Furniture and home furnishings stores jumped 7.5 percent.
  • Electronics and appliance stores rose 6.7 percent.
  • General merchandise stores increased 4.3 percent.
  • Clothing and accessories stores were up 2.7 percent.
  • Health and personal care stores rose 2.2 percent.

Consumers cut spending at department stores, with sales dropping 1.1 percent last month, while sporting goods fell .5 percent year-over year.

Friday's results exceeded the holiday forecast by the National Retail Federation of between $678.8 billion and $682 billion, which would have been a rise of 3.6 percent to 4 percent.

"Results are even better than anything we could have hoped for," federation CEO Matthew Shay said in a statement. "With this as a starting point and tax cuts putting more money into consumers' pockets, we are confident that retailers will have a very good year ahead."

Philadelphia shoppers mirrored national patterns, according to a report by First Data, which processes about 40 percent of card transactions in the U.S.

Its analysis released Wednesday showed that overall spending among Philly shoppers in stores grew 4 percent this last holiday season from last year. Among the top 30 cities, Philadelphia ranked No. 12 in terms of total dollars spent in November and December.

Retail spending represents 35 percent of all spending in Philly, and grew 3.7 percent during the holiday season.

"Any time you have a season like this, it can't be bad for retailers," said Glenn Fodor, First Data's head of information and analytics solutions. "Overall, the underlying secular trends remain with the fast-growing e-commerce sector. That just continues to grow, especially among retailers that are embracing the digital transition better than others."