BlackBerry Ltd. boosted its fiscal 2017 earnings outlook and posted a profit in the third quarter, showing that the company’s bet on moving more into software and completely away from handsets is paying off.

Fiscal third-quarter earnings per share, excluding some items, were 2 cents, compared with analysts’ average estimate of a loss of 1 cent. BlackBerry said it now expects to post a profit for the full year, up from a prior range of breakeven to a five-cent loss, according to a statement Tuesday. Shares rose as much as 4.4%, the biggest intraday gain in two months. They were up 3.6% to $7.99 at 9:47 a.m. in New York.

Total revenue was down and missed estimates, but the profit numbers and forecast show BlackBerry’s transition to a higher-margin software company from an ailing smartphone maker is hitting CEO John Chen’s targets. The adjusted profit margin was almost 70% of revenue, its highest ever.

BlackBerry now gets more than half of total revenue from its collection of software products, which include operating systems for car entertainment systems, secure file sharing software and programs to help companies keep track of their mobile devices. Last week, Chen announced a deal with TCL Corp. to license its brand to the Chinese manufacturer, effectively outsourcing the rights to design, produce and distribute BlackBerry devices around the world.

Chen said software revenue would grow to around $640 million in the year ending March compared with $494 million the previous year.

“We remain on track to deliver 30% growth in company total software and services revenues for the full fiscal year,” Chen said in the statement. “BlackBerry is now a software company.”

BlackBerry’s net loss for the quarter was $117 million, or 22 cents a share.

By Gerrit De Vynck