(Adds detail, background)
STOCKHOLM, July 18 (Reuters) - Mobile telecom equipment maker Ericsson posted an unexpected swing to a modest operating profit, saying it was boosted by growing sales traction in North America, which gave it confidence of meeting longer-term financial targets.
Ericsson said on Wednesday it had completed an annual cost savings programme by saving more than 10 billion crowns, which would increasingly be reflected in its earnings.
"We have good market traction in Networks, with a sales growth of 2 percent, particularly in North America where all major operators are preparing for 5G," CEO Borje Ekholm said in a statement.
The Swedish mobile telecom gear maker has met an industry-wide downturn and mounting losses by setting a new strategy to focus on profitability over growth, swapping out most of its management and making sweeping cost cuts.
Marking its second consecutive quarter of substantial progress toward hitting its 2020 financial goals, the Swedish firm posted an operating profit of 0.2 billion crowns ($22.6 million), compared to a 0.5 billion loss a year ago. Analysts, on average, forecast a 0.1 billion loss in a Reuters poll.
The company has pledged to deliver a gross margin of 37-39 percent and an operating margin of 10 percent by 2020. Its second quarter gross margin, excluding restructuring charges, was 36.7 percent, versus 35.9 in the first quarter.
Ericsson, once the world's biggest supplier of mobile communications gear, is facing falling spending by telecom operators, weakness in formerly fast-growing emerging markets and stiff competition from bigger telecom equipment players Huawei of China and Nokia of Finland.
Shares of Ericsson have risen around 25 percent so far this year, buoyed by progress it is showing toward meeting its 2020 financial targets, after three years of steep revenue declines.
Bolstering investor optimism are expectations that Ericsson is on the cusp of a new cycle of network upgrades as demand for next-generation 5G gear kicks in later this year or early in 2019, starting in the United States.
$1 = 8.8602 Swedish crowns Reporting by Olof Swahnberg and Helena Soderpalm, editing by Anna Ringstrom and Eric Auchard