BlackBerry has surprised Wall Street by posting a profit for the first quarter.

The embattled smartphone company reported net income of 23 million US dollars (£13.5 million), or 4 cents per share, for the three months ended May 31.

It had reported a loss of 84 million dollars (£49.3 million), or 16 cents per share, a year ago.

Excluding unusual items, its adjusted loss was 11 cents per share in the latest period. Analysts surveyed by FactSet expected a loss of 35 cents per share.

Revenue fell to 966 million dollars (£567 million) compared with 3.07 billion dollars (£1.8 billion) a year ago. Analysts expected 961.7 million dollars (£564 million).

It was the third quarterly results under new chief executive John Chen, who is de-emphasising the hardware business after last year's launch of the BlackBerry 10 failed to spark a turnaround.