Profit before tax for June-August, the company's third quarter, came in around 2 billion Swedish crowns ($229 million).

That was well below 5 billion crowns a year earlier, but much higher than analysts' mean forecast of 191 million crowns, according to Refinitiv's SmartEstimate model, which is weighted towards more recent estimates and higher-ranked analysts.

"H&M group's recovery is better than expected," the company said in a statement on Tuesday. "More full-price sales combined with strong cost control enabled the company to already turn to profit in the third quarter."

Sales fell 19% to 50.9 billion crowns, against expectations for an 18% drop. In local currencies, the fall was 16%.

"Very good news and well above consensus," said Societe Generale analyst Anne Critchlow of the third-quarter profits.

She has a 'hold' rating on the shares, which were up 11% in early trade, reducing their year-to-date decline to 16%.

Shortly after company veteran Helena Helmersson replaced the grandson of H&M's founder as CEO in January, the pandemic slammed H&M, pushing it into a deep loss in the March-May quarter as sales halved.

The company, which will publish its full quarterly report on Oct. 1, has been cutting staff, opening fewer new stores than planned and permanently closing others to cut costs.

"After its Q2 results, management warned that increased markdowns would hamper its earnings by around 2-3%-points, but this now appears to have reversed to a slight positive effect," analysts at Carnegie said in a note.

Analysts have been warning it will take time for fashion retailers' sales to recover to pre-pandemic levels, and recent signs of second waves of COVID-19 infections in some countries have added to the uncertainty.

RBC analyst Richard Chamberlain, with a 'sector perform' rating on H&M, said H&M's profit improvement augured well.

"We think most of this can be sustained going forward and expect consensus profit before tax upgrades for 2021-22 in the range of 5-10% following today. We also think this is a positive read for the apparel sector in general, eg, (Primark owner) ABF, Inditex and Next," he said.

H&M's biggest rival, Zara owner Inditex, will report May-July results on Wednesday. Britain's Next and John Lewis report on Thursday.

By Anna Ringstrom