Macy's holiday sales dropped, the company announced Wednesday, but not as much as analysts had anticipated, sending the department store chain's shares sharply higher.

It said same-store sales fell 0.6% at its owned and licensed stores during November and December. At owned stores, same-store sales fell 0.7% during that period.

For the fourth quarter, which includes the holiday season, analysts had been calling for a 1.75% decline in same-store sales, according to a poll by Refinitiv.

Macy's shares climbed as much as 7% in premarket trading on the news, which provided some hope that some of Macy's efforts to win back customers are gaining traction. However, the stock reversed its gains after Macy's said it would close 28 Macy's locations and 1 Bloomingdales location. Shares closed up 2.4%.

"Macy's performance during the holiday season reflected a strong trend improvement from the third quarter," CEO Jeff Gennette said in a statement. "Customers responded to our gifting assortment and marketing strategy, particularly in the 10 days before Christmas."

It was expected that America's department store chains suffered through another disappointing holiday season.

The category of retailers that also includes J.C. Penney and Nordstrom, saw overall sales decline 1.8% from Nov. 1 through Dec. 24, according to Mastercard Spending Pulse, which tracked retail spending across all payment methods.

More shoppers are expected to have turned to retailers like Target and Walmart — which aren't at traditional malls — for apparel, electronics and other gifts. Many rung up purchases on Amazon as well. The e-commerce giant has already claimed 2019 was a record holiday.

When Macy's reported quarterly earnings at the end of November, it trimmed its full-year sales and profit outlook. The company blamed its lackluster results in part on "weaker than anticipated performance in lower tier malls." But Gennette had said he had "confidence" in Macy's holiday plans.

There were six fewer days between Thanksgiving Day and Christmas Day in 2019 than in 2018, making for the shortest holiday season calendar possible. Analysts said the abbreviated season put more pressure on companies to offer deals to shoppers. Some retailers likely deployed steeper and more frequent discounting, which in turn puts pressure on profit margins.

As of Tuesday's market close, Macy's shares were down a little more than 40% over the past 12 months. The department store chain has a market cap of roughly $5.5 billion.