CHICAGO (Reuters) - Macy's Inc M.N shares climbed more than 11 percent on Thursday after the department store chain forecast a jump in online sales in the crucial holiday quarter and said it would maintain its tight grip on inventory.

The retailer also reported an improvement in margins for the first time this year and a third-quarter profit that topped Wall Street estimates thanks to cost and inventory controls.

The surge in shares erased some of their heavy losses since Macy’s previous earnings report, but analysts remained skeptical about the company’s long-term prospects.

“Investors are pleased that Macy’s beat on earnings and are also encouraged by the positive sentiment from the CEO about holiday trading,” GlobalData Retail’s Neil Saunders said. “None of this makes up for the lack of a clear long-term strategy, but it is a nice sort-term gain in a difficult market.”

Macy’s has started the U.S. holiday shopping season in a good inventory position and should log double-digit online sales growth in the fourth quarter, Macy’s Chief Executive Jeff Gennette said on a call to discuss the earnings.

Shares in Macy's were last up 11.7 percent on Thursday, even as the Dow Jones U.S. retailers index .DJUSRT fell by 0.2 percent.

The retailer has worked to rein in inventory to match declining foot traffic and boost weak margins as shoppers increasingly turn to off-price retailers and Amazon.com Inc AMZN.O.

A customer exits after shopping at a Macy's store in the Brooklyn borough of New York, U.S., May 11, 2017. REUTERS/Brendan McDermid

The company has also been closing stores and selling or renting out prime real estate properties, and in late 2015 launched its Backstage discount business to compete with off-price sellers.

But sales, which have declined for several straight quarters, fell short of analyst estimates in the third quarter after hurricanes Irma and Harvey kept customers out of some stores and warmer-than-expected weather crimped demand for winter clothing.

And despite the forecasted online growth, Gennette said Macy’s now expects overall holiday-quarter sales at the lower end of its previous guidance. That would imply a decline of 2 percent, JPMorgan analysts wrote in a note.

Macy’s shares have lost more than a fifth of their value since the company reported second-quarter results. Analysts have speculated recently that Macy’s may cut its dividend in favor of paying down debt, further weighing on the stock price.

Chief Financial Officer Karen Hoguet noted repeatedly on the call that Macy’s was generating more cash than it needed to cover its dividend and capital expenditures while also paying down debt.

Excluding items, Macy’s earned 23 cents per share in the quarter ended Oct. 28, beating the average analyst estimate of 19 cents.

Sales at Macy’s stores open more than 12 months, including sales in departments licensed to third parties, fell 3.6 percent, missing the average analyst estimate of a 2.6 percent decline.

Gross margins rose to 39.9 percent from 39.8 percent a year ago, while the cost of sales declined to $3.18 billion from $3.39 billion.

Kohl's Corp KSS.N meanwhile reported higher same-store sales for the first time in six quarters but a lower-than-expected third-quarter profit due to higher costs, store closures and hurricanes.

Kohl’s CEO Kevin Mansell said the retailer was well-positioned for the holiday quarter, with lean inventories and strong sales expected from its online business, and in active apparel and footwear.

Kohl’s shares reversed early losses and were last up 0.6 percent.