Hennes & Mauritz, the world's second-biggest fashion retailer, plans to step up the pace of its online expansion next year to catch up with rivals in e-commerce.

The Swedish budget fashion firm also said on Wednesday that sales in June had got off to a good start after it reported second-quarter profit in line with analysts' forecasts due to brisk spring sales and increased market share.

H&M, which was slower than many of its peers to start selling online, said it would launch websites in eight to 10 markets in 2015 after rolling them out in Spain, Italy and China later this year.

It currently has an online presence in 10 markets, in many parts of Europe and the United States, less than half compared with Zara-owner Inditex, its bigger rival that sells online in 25 markets.

H&M Chief Executive Karl-Johan Persson said both its physical and online stores were profitable, adding that the group had seen some loss of sales in stores as customers turned to its online channel.

"It's likely to continue for many years with younger people who grow up with more online shopping, but we still have a big belief in the physical stores so I think we can have a good development in both," he said.

H&M is investing heavily to develop new online sites and broaden its product offering with other brands such as COS, & Other Stories and H&M Home. It plans to open 375 stores this year, opening for the first time in the Philippines and India in the second half of the year.

Pretax profit was 7.6 billion Swedish crowns ($1.1 billion) for March through May, matching an average forecast in a Reuters poll of analysts. Its gross margin was 60.8 percent - just below the forecast 61.2 percent.

"Our investments will affect H&M profitability in the short term negatively but in the long-term positively," Persson said.

H&M has faced increasing competition from discount rivals such as Britain's Primark and U.S. group Forever 21 which are expanding across Europe and from online firms such as Britain's ASOS and Germany's Zalando.

Persson told a news conference Primark was a really good player which the group had "great respect for".

Bernstein Research said in a note it expected H&M margins would continue to contract in the second half due to competition and rising wages in Asia where the retailer produces the vast majority of its garments.

Inditex said last week it would join China's fast-growing Tmall online marketplace, run by Chinese e-commerce giant Alibaba, to strengthen its presence in the country.

But Persson said H&M, which prefers to sell through its own channels, has no plans to make a similar move.

"We will not start there - we will start with our own. It's working well in the 10 markets where we are present. I believe that it will work well in China," he said.

H&M garments are all sold on its own sites, though the company does offer its Monki brand on ASOS.

H&M, which reported quarterly sales last week, said June sales were off to a good start after a near 20 percent increase in May and Persson said the picture was brighter across Europe, improving in places like Spain, Italy and Greece which are starting to recover from recessions.

"My best guess is that the worst is behind us and that it is stabilizing more, or slightly improving," he said.

Inditex said last week its sales rose 11 percent in local currencies between Feb. 1 and June 8, accelerating from the 8 percent it recorded in the year to Jan. 31.