World number one mobile network gear maker Ericsson beat expectations for earnings and margins in the first quarter raising hopes that recent market weakness has bottomed out.

The telecoms equipment market recovered strongly in 2011 as operators invested to catch up with a surge in traffic from smartphones and tablets, but the final quarter saw renewed concern about global growth and, for Ericsson, a shift in business that cut deeply into margins.

With global economic growth likely to be modest this year and with the company saying that low margin projects would continue to dominate, analysts had fretted Ericsson was facing an extended downturn.

First-quarter results brought some relief for Ericsson, which is double the size of its nearest competitors - China's Huawei and Nokia Siemens Networks - in market share.

Gross margins... surprised positively well ahead of consensus, so the nice beat on the gross margin is the key take away here I think as people were fearing that the low trend set in Q4 last year would continue, said Alexandre Peterc, analyst at brokerage Exane BNP Paribas.

Ericsson's underlying earnings before interest and tax reached 2.8 billion crowns ($416 million) excluding loss-making joint ventures but including restructuring charges.

That was down 56 percent on the year before but topped a mean forecast of 2.5 billion in a Reuters poll.

The group's gross margin rose to 33.3 percent in the quarter from 30.2 percent in the final three months of 2011, a trend the company pinned on seasonal effects, a greater share of higher-margin capacity expansion projects and a smaller share of lower-margin services business.

Greger Johansson, analyst at Redeye said that analysts would probably revise up forecasts for the gross margin for the rest of the year.

I think the Q1 report was kind of a relief. You don't have to expect anything worse going forward, he said.

Ericsson shares were up 1.6 percent at 64.45 crowns at 1142 GMT, in line with a 1.6 percent rise in European technology stocks <.SX8P>.

TOUGH ENVIRONMENT

While there were positive signs on the gross margin, sales in the key networks unit were down 18 percent. Total sales were 51.0 billion crowns, versus a forecast of 52.9 billion.

Ericsson said operators remained cautious due to the macroeconomic environment.

Ericsson's caution chimed with that of rivals Huawei and Nokia Siemens Networks which have warned the soft global economic outlook could prompt telecom carriers to cut investments.

In the medium to longer term, however, the outlook is more positive. Hardware heavy, modernization projects should start to wash out of results after this year, helping margins, and Ericsson hinted at a pick up in the key North American market after six months of slack demand.

I don't see the cautious operators there, Ericsson Chief Executive Hans Vestberg said.

Furthermore, growth in smartphones and tablets will drive investment in capacity while new 4G networks across much of the world and a wave of network upgrades in Europe is expected in the next couple of years.

Having gained market share in Europe in 2011 at the expense of margins, Ericsson is a good position to capitalize on a recovery in spending in the region.

We see the lukewarm reaction of the stock as an opportunity to get involved and expect positive earnings momentum this year, as well as elements of our longer term thesis (good growth, margin expansion) to start playing out by year end, Sanford Bernstein analyst Pierre Ferragu wrote in a note.

($1=6.7368 Swedish crowns)

(Additional reporting by Sven Nordenstam and Olof Swahnberg; Editing by David Holmes and Mike Nesbit)