BlackBerry  (BBRY) said it broke even in the first quarter on an adjusted per-share basis, beating analysts' forecasts, as it continued to cut costs and grow its software business.

The Waterloo, Canada-based company posted an adjusted loss of $1 million, compared with a net loss of $238 million, or 3 cents a share, in its latest fourth quarter. Analysts were expecting a first-quarter loss of 7 cents a share.

Non-GAAP revenue for the period was $424 million, down from $487 million in the fourth quarter, with about 39% from software and services, 25% from service access fees, and 36% from mobility solutions.

Though BlackBerry has a devoted fan base that hasn't been enough for the once-popular mobile device company to tough it out against the rise of other smartphone makers, particularly as they began to feature increasingly sophisticated security software to rival BlackBerry's design.

CEO John Chen acknowledged ahead of the earnings report that earnings from hardware are likely to fall 24% this year. The company, valued at $3.68 billion, reported a loss of 19 cents a share in fiscal 2016 so its interests lie in updating software rather than in its devices.

In April, Chen said the company would consider ditching its hardware business by September if it couldn't generate large enough profits.

"For the full fiscal year, we are on track to deliver 30% revenue growth in software and services," Chen said. "Based on a more efficient operating model, we expect a non-GAAP EPS loss of around 15 cents, compared to the current consensus of a 33 cent loss."

BlackBerry shares rose 3% in premarket trading.