* Q2 pretax profit 7.1 bln SEK vs consensus 6.6 bln
* Gross margin unchanged at 61.7 pct vs f'cast 61.1 pct
* Says took market share in challenging market
* Shares climb 2.5 pct (Adds quotes, analysts, share price)
By Patrick Lannin and Rebecka Roos
STOCKHOLM, June 20 (Reuters) - Hennes & Mauritz, the world's second-biggest clothing retailer, beat quarterly profit forecasts, joining larger rival Inditex in showing austerity-hit shoppers are keen to cheer themselves up with cheap fashions.
The Swedish group also reported steady gross profit margins on Wednesday, raising hopes that a long-standing drag from higher cotton prices is coming to an end.
"Many countries are still in a challenging macro-economic situation with austerity measures and restrained consumption," H&M said, as it hailed strong sales of spring and summer ranges including soft pastel dresses and Hawaiian-inspired resort wear.
"The fact that H&M continues to gain market share even in these challenging markets is a clear sign that H&M's strong offering is appreciated by customers worldwide."
Many European retailers are struggling as disposable incomes are squeezed by rising prices, muted wages growth and government cutbacks, while confidence is rattled by a sovereign debt crisis.
H&M and Spain's Inditex have fared better than most thanks to a focus on low-priced fashions and broad geographic spreads that include faster-growing emerging markets.
Inditex, which runs the Zara chain, last week beat first-quarter profit forecasts.
H&M chief executive Karl-Johan Persson said spring and summer ranges including pleated skirts and smock tops had been snapped up "in all our 44 markets, in big cities as well as small cities - and in both countries with strong economic growth and countries with a tough macroeconomic climate".
Espirito Santo analysts hailed H&M's better-than-expected performance on both profit margins and operating costs, but said they continued to prefer Inditex.
The Spanish firm has outperformed its Swedish rival in recent quarters, helped by its broader range of brands and by the fact it sources a smaller proportion of goods from Asia, where labour costs have been rising.
H&M shares, which have beaten the STOXX Europe 600 retail index by 11 percent this year but lagged Inditex by about the same amount, were up 2.5 percent to 236.2 Swedish crowns at 0920 GMT.
MARGIN PRESSURE EASES
H&M said pretax earnings reached 7.1 billion crowns ($1 billion) in its second quarter, which runs from March to May, compared with 5.8 billion a year-ago and a mean forecast in a Reuters poll of analysts for 6.6 billion.
The group has had a policy of holding prices rather than passing on cost increases, like cotton, to customers. While this has helped it to gain market share, is has hit profit margins.
However, H&M said on Wednesday the impact of higher cotton prices had been almost neutralised and it posted an unchanged gross profit margin of 61.7 percent, topping a consensus forecast for 61.1 percent.
"This is clearly due to easing input prices in Asia, which is coming through faster than expected. I think that will be even better in the next quarter," said Cheuvreux analyst Daniel Ovin.
H&M, which has around 2,500 stores and the bulk of its business in Europe, said markdowns in relation to sales were unchanged from a year earlier.
The U.S. dollar had a relatively neutral effect in the second quarter, but would become negative for purchases for the second half of the year, it added. Inventories were up 8 percent year-on-year at the end of the quarter.
H&M, which already has a track record in leveraging sales by cooperating with well known designers, has in recent years branched out of its core H&M brand into new chains, following the example set by Inditex.
The group, which is expanding in China, the Unites States and Russia and plans to enter five new markets, said it remained positive on prospects for continued growth.
($1 = 6.9595 Swedish crowns) (Addtional reporting by Anna Ringstrom and Sandra Jansson; Editing by David Holmes and Mark Potter)