BlackBerry on Thursday morning reported earnings that beat the Street’s expectations by a significant margin, suggesting that the company’s cost-cutting measures are paying off more quickly than analysts expected. For the fiscal first quarter ended in May, BlackBerry reported a loss of $0.11 per share versus the consensus estimate of a $0.25 loss per share. The company’s $966 million in Q1 revenue missed the $976 million analysts were looking for, but smartphone shipments improved to 1.6 million units from 1.3 million in the year-ago quarter. Including non-cash and one-time items, BlackBerry actually managed a small profit of $23 million in the quarter.

BlackBerry’s cash and cash equivalents totalled $3.1 billion in Q1, up sequentially from $2.7 billion.

“Our performance in fiscal Q1 demonstrates that we are firmly on track to achieve important milestones, including our financial objectives and delivering a strong product portfolio,” said CEO John Chen. “Over the past six months, we have focused on improving efficiency in all aspects of our operations to drive cost reductions and margin improvement. Looking forward, we are focusing on our growth plan to enable our return to profitability.”

BlackBerry said that approximately 2.6 million BlackBerry smartphones were sold through to end users in the fiscal first quarter.

Shares of BlackBerry stock were up 10% in pre-market trading after initially dipping 2% following the company’s report.