SAN FRANCISCO — Twitter often feels like the digital equivalent of a swamp.
The Russians used the platform to disrupt the 2016 election. Famous people buy fake followers to make themselves seem more famous. Prominent members of the chattering class have been signing off for good. Sometimes it seems as if no one loves the service except for President Trump.
As a business, however, Twitter might finally be starting to work.
On Thursday, it reported a profit in the fourth quarter, the first black ink since going public in 2013. The news pushed its shares up more than 20 percent in early trading to their highest level in more than two years. It closed up about 12 percent.
“We did what we said we were going to do,” an exultant Jack Dorsey, Twitter’s chief executive, said on Twitter. “Our focus and self-discipline continues to improve.”
It’s a measure of the undisciplined — OK, brutal — nature of Twitter that most of the replies to Dorsey’s tweet were not congratulations but insults and criticism. Others were incomprehensible.
What counts, however, is that those cranks and critics are there in the first place. The number of people who use the service each month rose 4 percent to 330 million, which — while not a big increase — is something. Those who use the social media service every day grew 12 percent from the fourth quarter of 2016, the fifth consecutive quarter of double-digit gains.
“The user growth is kind of astounding,” said Rich Greenfield, a media and tech analyst at the research firm BTIG, who has been recommending the stock for a year. “They were barely growing two years ago.”
Here is the dynamic that Greenfield believes is driving Twitter: “If you show the right tweets to the right person at the right time, it creates user happiness. That means more time spent on the site, which means more opportunities for advertising.”
Overall, Twitter reported a profit of $91 million in the last three months of 2017, compared with a loss of $167 million a year earlier. Other numbers were not as impressive. Revenue rose 2 percent to $732 million in the quarter. Revenue from advertising, which makes up the bulk of its revenue, increased 1 percent. But in general, Twitter exceeded low expectations.