Twitter shares surged after third-quarter earnings beat expectations, while investors shrugged off a company mistake that resulted in an over-estimation of monthly active users going back three years.

The social media giant said adjusted operating profit rose to 207 million US dollars (£157 million) in the third quarter, compared with 181 million dollars (£137 million) during same period last year.

It also narrowed it net loss to $21 million (£16 million) from just shy of $103 million (£78 million) in the third quarter of 2016.

That was despite a 4% decline in revenue for the period to 590 million dollars (£446 million).

Investors were also cheering a jump in monthly average user (MAU) figures to 330 million, which was up 4% year on year and marked an increase from 326 million in the previous quarter.

Daily active users meanwhile surged 14% on an annual basis.

The news sent Twitter’s shares – which are listed on the New York Stock Exchange – up more than 14%.

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.”

However, the company was forced to admit a mistake that caused a miscalculation of MAUs dating back nearly three years.

“We discovered that, since the fourth quarter of 2014, we had included users of certain third-party applications as Twitter MAUs that should not have been considered MAUs,” it said.

Quarterly MAU figures were over-estimated by around 1 million in the fourth quarter of 2016 and by around 2 million in the first and second quarters of this year.

The company said it did not have accurate adjustment figures prior to the last three months of last year, due to its “data retention policies”.

Daily average user figures were not affected as those numbers do not include users from third-party apps, Twitter said.

The microblogging site is now expecting adjusted earnings to come in between 220 million dollars (£166 million ) and 240 million dollars (£182 million) in the fourth quarter, with margins at around 35% to 36%.

Twitter last month released full-year earnings covering its UK operations, which showed a slight rise in turnover from £76 million to £79 million in the year to December 31 2016, according to accounts filed at Companies House.

Pre-tax profit at the UK business – which operates under Ireland-based parent Twitter International – dropped from £3.37 million to £2.66 million, while its tax bill nearly halved from £1.24 million to £815,000.

Bottom-line profits for Twitter UK dropped from £2.1 million to £1.8 million for the period.

The British operations were hit by job cuts that affected around 9% of the company’s global workforce, which were announced as part of wider group restructuring efforts in autumn 2016.

The UK company had around 187 staff in any given month, on average, in 2016.