Twitter Inc. (NYSE: TWTR) reported its first quarterly profit and better-than-expected revenue for the fourth quarter of its fiscal year. Revenue and adjusted profit both topped analysts’ targets. Twitter reported a net profit of $91.1 million, or 12 cents per share, compared to a loss of $167.1 million, or 23 cents per share, a year earlier. Adjusted profit was 19 cents per share, topping analysts’ expectations of 14 cents per share.

Overall revenue rose 2 percent year-over-year to $731.6 million, beating Wall Street’s estimate of $686.1 million. It was the first increase in revenue since the fourth quarter of 2016. Revenue from Japan rose 34 percent from a year earlier, increasing to $106 million. U.S. revenue fell 8 percent.

Twitter said revenue was helped by better ad targeting and higher video ad sales. Advertising revenue rose 1 percent to $644 million. The company reported $87 million in data licensing and other revenue, up 10 percent from a year earlier.

The company reported zero growth in Twitter’s users from a quarter earlier. Twitter reported 330 million monthly active users for the quarter, a 4 percent increase from a year earlier but flat from the third quarter. Analysts on average had expected 332.5 million monthly active users. Twitter said daily active users increased 12 percent from a year earlier, the fifth consecutive quarter of double-digit increases.

The company blamed its lack of subscriber growth in part on its purge of fake and spam accounts. A change that Apple Inc. made to its Safari web browser also reduced the tally of users by 2 million. Twitter had warned investors about those factors back in October.

Twitter shares surged 22 percent on the earnings report, hitting their highest level since July 2015. Shares in Twitter have surged 47 percent over the past 12 months. Twitter debuted as a public company in 2013 at $26 a share. Its shares are now trading above $30.

Twitter has made numerous changes to the business over the past few years, while suffering a few setbacks. Twitter spent the second half of 2017 explaining how Russian-linked accounts on its platform may have influenced the results of the 2016 U.S. presidential election. The company is now taking action to limit automated bots, fake accounts, and user harassment on the site.

In the past year, the company has doubled the number of characters allowed in each tweet in most languages. Twitter has also struck deals with media companies for live news and entertainment shows. Chief Executive Jack Dorsey said Twitter will also be doing more experimentation to make its timeline more “personalized and relevant” to people. Dorsey hopes that these tweaks will attract more users.