BlackBerry makers Research In Motion have reported a loss of $235m for the quarter - but their shares have jumped anyway.
The beleaguered company said that its loss for the three months ending September 1 compared to a $329m profit last year.
It has suffered from years of declining sales, and has failed to recapture the momentum for its smartphones after the rise of Apple's iPhone platform and Google's market-leading Android OS.
And while Microsoft is seen to be catching up to the two leaders with its imminent release of Windows Phone 8, RIM is yet to deliver its next-gen BB10 OS.
But in its earnings call RIM said it managed to increase its cash reserves from $2.2bn to $2.3bn - and investors appeared pleased that its performance wasn't as bad as feared.
Around 7.4 million BlackBerry handsets were shipped in the quarter, higher than an expected 6.9m.
RIM's shares rose almost 18% in after-hours trading, the biggest rise since a 50% jump in 2003.
Analysts said the company was performing well in emerging markets.
"You still have revenue declining 31 percent on a year-over-year basis but it's certainly not the train wreck that a lot of people feared," BGC Partners analyst Colin Gillis told Reuters. "They live to fight another day."
But the news was not all good - while RIM sold more handsets than had been feared, its tablet sales were lacklustre at best.
In total RIM said it sold 130,000 Playbook tablets, compared to 17m iPads sold in the last quarter alone.
CEO Thortsen Heins, said that the company was betting its fortunes on BB10, the latest update of its flagship operating system, when it is released next year.
"Make no mistake about it, we understand that we have much more work to do," Heins said. "But we are making the organisational changes to drive improvements across the company, our employees are committed and motivated, and BlackBerry 10 is on track to launch in the first calendar quarter of 2013."