Twitter is finally in the black.
The company said Thursday it posted a modest $91 million profit in the final three months of 2017, marking the first time the company has had a profitable quarter since going public in 2013.
Twitter (TWTR) says it expects to be profitable for all of 2018 as well.
It's a hard won milestone for Twitter. The company has gone through multiple rounds of layoffs since cofounder Jack Dorsey returned as CEO in 2015. And it has cut beloved but pricey projects like Vine, a video sharing service.
Twitter also received a boost from a surprise rebound in its advertising business. The company posted sales of $732 million for the quarter, up 2% from the same period a year earlier, reversing a sales decline that has plagued the company in recent quarters.
Related: Top Twitter executive departs, putting pressure on Jack Dorsey
In a letter to shareholders, Twitter chalked up the sales boost to "better-than-expected growth" in ad sales "across all major products and geographies."
The stock jumped more than 20% in pre-market trading Thursday following the earnings report.
The sales rebound and profitability milestone offer hope that Twitter's turnaround efforts are bearing fruit. Beyond cost cuts, Twitter has pushed for product tweaks to make the service more intuitive to new and existing users.
During the quarter, Twitter doubled the character limit of tweets for all users. While it received some backlash from longtime users, Dorsey called it a success on Wednesday.
"We're seeing a lot more retweets. We're seeing a lot more mentions," he said on a conference call with analysts Wednesday. "We do believe that it is minimizing some of the complexities and some of the confusion around Twitter in general."
Twitter also introduced an option to make it easier to thread tweets and launched Happening Now, a feature intended to highlight content around events like sports games.
Daniel Ives, an analyst with GBH Insights, called the earnings results "a breath of fresh air for investors that have patiently awaited for this turnaround story to manifest after years of pain."
However, Twitter continues to face significant challenges in that turnaround story.
Twitter's user growth remains stagnant. It had 330 million monthly active users for the quarter, effectively failing to grow its audience at all.
In fact, Twitter's audience in the U.S. declined slightly. It had 68 million users in the country in the fourth quarter, down from 69 million in the prior quarter.
On the conference call, Twitter executives stressed the social network's five consecutive quarters of daily user growth. But Twitter continues to declines to provide a hard number for its daily audience.
Last month, Twitter's COO Anthony Noto announced plans to leave the company to take over as CEO of a startup. Noto had previously served as Twitter's CFO and was arguably the most important executive at the company other than Dorsey.
Twitter has said Noto's responsibilities will be handled by various members of its leadership team. Dorsey continues to be a part-time CEO, running both Twitter and Square (SQ).