Macy’s Inc. plans to shut nearly 30 stores and said its sales fell during the holiday months, but the sales decline wasn’t as sharp as investors had feared amid mounting competition and a shift to online shopping.

The department-store company said comparable-store sales for November and December fell 0.6% from a year earlier for its owned and licensed merchandise. On that basis, sales fell 3.5% in the autumn quarter. Comparable sales include those at stores open at least a year.

...