Shares in Twitter have risen sharply after the company said it could be on course to turn its first-ever quarterly profit.
Wall Street cheered results for the three months to the end of September that suggested its drive to cut expenses and find new sources of revenue were bearing fruit.
Twitter shares have performed woefully since it made its stock market debut in 2013 but they jumped 18% on Thursday as the company looked on the verge of delivering a profitable bottom line.
It was the most notable winner on a day when other tech heavyweights – Google owner Alphabet, and Amazon – also posted well-received quarterly results.
Twitter has struggled to capitalise on its popularity with public figures such as Donald Trump to attract more users and advertisers away from competitors such as Facebook and Snapchat.
Third quarter results showed a net loss of $21m, but that was sharply lower than the same period in 2016 when it was in the red to the tune of $103m.
Underlying earnings rose by 14% to $207m.
Twitter said that for the current fourth quarter, it if reaches the high end of its own estimates, it would "likely be GAAP profitable" – referring to a "generally accepted accounting principles" measure of profit.
It has never before posted a quarterly profit using this measure.
The company also said it had discovered an error in the way it calculates its user base since 2014 and revised its estimate downward, though the difference amounted to less than 1% – and the disclosure seemed to have little negative impact on investors.
Twitter said it had 330 million monthly active users in the third quarter, up four million from the prior three months, helped by greater use of email and push notifications, and in line with expectations.
Revenue declined by 4% compared to a year earlier, to $590m, also roughly in line with Wall Street estimates – the third fall since Twitter went public as Facebook and Google come to dominate the business of internet ads.
Chief executive Jack Dorsey said: "This quarter we made progress in three key areas of our business: we grew our audience and engagement, made progress on a return to revenue growth, and achieved record profitability.
"We're proud that the improvements we're making to the product continue to bring people back to Twitter on a daily basis."
Twitter's bottom line was improved by a 16% cut in expenses from a year earlier.
The company has stepped up efforts to keep people engaged through live streaming deals including concerts, sporting events and news programmes.
It is also diversifying revenue beyond advertising in areas such as selling data that can be mined by companies interested in consumer behaviour.
Last month, Twitter began a test of tweets as long as 280 characters – double the existing cap.
Twitter's much-heralded stock market debut four years ago saw investor demand push the share price above $73. It has since fallen sharply but even after Thursday's strong rise was still only around $20.
Elsewhere, Amazon – the world's largest online retailer – saw shares rise 6% in after-hours trading as it said third quarter sales jumped 34% to $43.7bn and profits climbed to a better than expected $256m.
Its results were boosted by its best-ever Prime Day shopping event which took place in July.
Alphabet also rose in after-hours trading as quarterly revenues, boosted by robust mobile advertising, climbed 24% to $27.8bn and profit rose 33% to $6.7bn.