Twitter posted a surprise profit in its Thursday earnings report — marking the first time it's ever made money as a public company.

The company attributed its improved finances to a focus on its strongest selling point: connecting advertisers and the people they want to sell things to in real-time.

“Twitter continues to help our partners be relevant in the moment at scale,” chief executive Jack Dorsey said in the quarter's shareholders letter. Stronger ad sales in the crucial holiday quarter made up the difference for Twitter, even as the number of new people joining the site continued to stagnate.

Twitter reported not only profit but also a return to revenue growth, posting $732 million vs. analyst expectations of $686 million.

Shares jumped as much as 22 percent from Wednesday's closing price of $26.91 following the earnings report; as of midday trading, they were sitting around $31.27 per share.

The improved performance comes even though Twitter missed predictions about the number of people using the site by about 2 million. According to Twitter, 330 million people used the network in its latest quarter; about a 4 percent increase from the same time last year. U.S. users fell slightly, to 68 million from 69 million.

Yet even within those relatively flat user numbers, there was a bright spot: The number of people who use Twitter daily increased by about 12 percent from the same time last year. That may have been spurred on by the company's decision to double its character count in November. Dorsey said that the increased limit has encouraged people to write more often on Twitter, though not necessarily with significantly longer messages.

The strong financials were a welcome change for Twitter, which has had a bruising quarter as it continues to face criticism over how false information and harassment spread on its network. The company in January also lost its chief operating officer, Anthony Noto — a crucial lieutenant to Dorsey as the Twitter founder continues to act as chief executive for both Twitter and Square.

Yet while Twitter can celebrate, it's still not making a significant dent in digital ads — a space dominated by Google and Facebook. Combined, those two companies make up an estimated 26 percent of the worldwide digital ad market, according to eMarketer. Twitter carries about 1.2 percent of the market — roughly on par with Facebook's Instagram. And though the overall digital ad market is expected to continue growing, Twitter's share of the pie is not, according to eMarketer.

In the long-term, analysts said, it will be hard for Twitter to make significant gains against its competitors. Even with changes afoot at Facebook, which is struggling to balance how sponsored content and personal posts on its news feed, Twitter's place in the ad market is unlikely to change soon.

There's no indication that Twitter benefited from changes to Facebook's algorithm, said Brian Wieser, an analyst from Pivotal Research who downgraded Twitter to a “sell” rating Thursday despite the strong quarter.

Twitter's earnings follow better-than-expected earnings from Snapchat's parent company Snap, which announced strong growth for users and revenue. The two companies have been competing fiercely for ad dollars.