Ericsson (ERIC - Get Report)  gained in Friday trading on better margins in its networks unit despite reporting a larger-than-expected third quarter operating loss.

Shares were up 5.6% in the first hour of trading in Stockholm, to change hands at Skr51.60, that is Ericsson's biggest rise since June 2016, but pared some gains by mid-morning and were marked 3.44% higher. 

The Swedish telecoms company said Friday that sales in the three months to the end of September were down by 6% to SKr47.8 billion ($5.85 billion), in line with analyst forecasts, but reported an operating loss of SKr4.8 billion, outpacing estimates of a loss of SKr3.5 billion.

The company's gross margin excluding restructuring charges came in at 30.0%, compared with analysts' estimates of 29.8%, driven by increased margin improvement in its networks unit.

Operating profit in the quarter was hit by SKr1.5 billion in costs due to development and hardware costs, SKr2.3bn in adjustments to customer projects, and SKr2.8bn in restructuring costs.

This was Ericsson's fourth quarter of consecutive losses as it sees increased competition from China's Huawei and Finland's Nokia (NOK - Get Report) .

Despite sales falling by 4% in its networks business, the company said that it expects to deliver double-digit margin growth adjusted operating margin in the division in the fourth quarter of 2017.

The company reiterated is full year guidance despite the wider-than-expected loss. Ericson is aiming to double its operating margin to 12% after 2018 from 6% in 2016.

The company said its focus will be to improve profitability, through increased efficiency in service delivery, adding that it will scale the software part of the business mix and increase the level of pre-integration services, which will lead to a higher gross margin but lower services sales.

"We continue to execute on our focused business strategy. While more remains to be done we are starting to see some encouraging improvements in our performance despite a continued challenging market," CEO Borje Ekholn said in a statement. "Networks showed a slight sales growth year over year, adjusted for the rescoped managed services contract in North America and for currency. Networks adjusted operating margin was 11%. While losses continue in IT & Cloud, we see increased stability in product roadmaps and projects."

UBS analysts expect the stock to see some relief on improving top-line and networks margin. 

More of What's Trending on TheStreet: