NEW YORK (CNNMoney) -- BlackBerry reported a surprise profit in its fiscal first quarter. And investors loved the news.
Shares of the struggling smartphone maker surged more than 14% in mid-morning trading and are at their highest level since late March.
The company earned $23 million in the quarter. Excluding certain charges though, BlackBerry did post a loss of 11 cents per share. But analysts were expecting results to be much worse. The forecast of analysts polled by Thomson Reuters was for a loss of 26 cents.
Sales for the Waterloo, Ontario-based company fell 1% to $966 million, but that was better than Wall Street's consensus estimate of $963 million.
BlackBerry has been fighting an uphill battle to stay relevant in the world of mobile devices. It has lost market share to Apple, companies like Samsung that offer gadgets running on Google's Android operating system and Microsoft.
But John Chen, who took over as CEO in November, has injected new life to the company.
"I hope you share in our small celebration of a successful quarter," Chen said during the company's earnings call. "Right now, the main thing I'm focusing on is laying the groundwork for growth," he said. BlackBerry's new leader is confident that the company will return to profitability for a full year in 2016.
Chen, who says BlackBerry is getting close to breaking even on its hardware business, has steered the company's focus more towards software. He's made several product announcements that Wall Street has cheered. Last month, the company launched its Project Ion, an initiative to develop more connected devices ... a trend dubbed the Internet of Things.
On Wednesday, BlackBerry reached a deal with Amazon that will let users of BlackBerry's newest operating system access Android apps in Amazon's appstore later this fall.
Chen called the partnership a "win, win," saying that it will boost Amazon's subscriber numbers, while allowing BlackBerry to spend less time on the consumer side of its business and concentrate more on its corporate and government customers.
Chen added that focusing on value-added services like its BBM messaging app is going to be more important. BlackBerry plans to roll out new BBM Meetings and BBM for Windows in the second quarter. Following Facebook's $19 billion acquisition of WhatsApp, BlackBerry's once-popular BBM app was thrust back into the spotlight. Some investors felt that BlackBerry could also try and find a buyer for BBM.
But these new iterations of BBM and Chen's emphasis on businesses using the service show the company is attempting to reap the benefits of a BBM revival, not sell off the messaging service.
QNX12, the latest version of the company's operating system that has become the favored technology in the connected car market. is also coming out in the second quarter.
And it looks like Chen will have more breathing room to execute the turnaround plan. The company ended last quarter with $3.1 billion in cash, up from $2.7 billion in the previous quarter. There have been growing concerns about how much cash BlackBerry has been burning. But the company was able to boost its cash position thanks to a tax refund and sale of real estate.
Copyright 2015 Nexstar Broadcasting, Inc. All rights reserved. This material may not be published, broadcast, rewritten, or redistributed.