BlackBerry released its latest earnings report before opening bell, posting adjusted earnings of 2 cents per share on $289 million in GAAP revenue. Analysts had been expecting the company to break even on an adjusted basis with $330 million in revenue. In last year’s third fiscal quarter, BlackBerry reported $548 million in revenue.

BlackBerry Ltd BBRY

BlackBerry’s losses narrow

BlackBerry reported GAAP losses of 22 cents per share, a huge improvement from last year’s 71 cents per share in losses. Non-GAAP revenue came in at $301 million, while software and services revenue was $172 on a non-GAAP basis and $160 million on a GAAP basis. The non-GAAP gross margin reached a new record of 70%, while the GAAP gross margin stood at 67%, which also was a new record. Adjusted EBITDA was $37 million, marking the twelfth quarter in a row in which the metric was in positive territory. Total cash and cash equivalents stood at about $1.5 billion.

BlackBerry signed an agreement with Ford to use its QNX and security software and a long-term software licensing deal with TCL to manufacture, sell and supply BlackBerry-branded Android phones. The company also reported that it had more than 3,000 enterprise customer orders during the third quarter.

BlackBerry raises earnings guidance

Management pronounced that BlackBerry has successfully made the transition from being a hardware company to a software-focused firm.

“BlackBerry is now a software company and the market leader in mobile security,” said BlackBerry Executive Chairman and Chief Executive John Chen in a statement. “We achieved significant milestones in Q3, delivering the highest gross margin in the company’s history for the second consecutive quarter and continuing to transform our infrastructure and operations to support an enterprise software business. These accomplishments drove operating profitability in all business segments and overall positive non-GAAP EPS.”

Chen added that the company is still on track for 30% growth in software and services revenue for the full fiscal year. They also boosted their profit guidance for fiscal 2017, as they now look to be profitable on an adjusted basis for the full year, compared to their previous guidance for between breakeven and a loss of 5 cents per share.

Shares of BlackBerry initially surged by nearly 4% in premarket trades before falling back slightly. The stock was up 1.82% at $7.85 per share on the NASDAQ as of this writing.