World number one mobile network gear maker Ericsson beat expectations for earnings and margins in the first quarter, sparking hopes a period of market weakness has bottomed out and sending its shares up more than 3 percent.

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.

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.

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.

The first quarter saw little change in underlying business trends, but profitability improved compared with the fourth quarter and Ericsson shares were up 3.5 percent at 65.85 crowns by 0752 GMT.

The stock had plunged earlier this week to its lowest since late January.

Ericsson nonetheless stuck to its view of market conditions.

In the quarter, business trends from (the second half of 2011) prevailed, with cautious operator spending in regions with macro-economic or political uncertainty, it said in a statement.

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.

Sales in the company's key networks unit were down 18 percent. Total sales were 51.0 billion crowns, against a forecast of 52.9 billion.

Peterc at Exane BNP Paribas said sales were light, though this had been partly expected due to a decline in older, CDMA-standard equipment in the United States.

($1 = 6.7368 Swedish crowns)

(Editing by David Holmes)