Uncovering and explaining how our digital world is changing — and changing us.

This story is part of a group of stories called

Twitter is finally making some money. After nearly 12 years, the company reported its first-ever profitable quarter: It made $91 million in the last three months of 2017.

Investors loved the flip, and Twitter stock is up almost 16 percent.

But it didn’t get there by growing its business. It got there by cutting costs.

Twitter revenue only grew by 2 percent from a year ago. That makes sense since Twitter’s user base only grew by 4 percent in 2017, and the company didn’t add any net new users in Q4, maintaining its monthly user count of 330 million.

So Twitter cut costs to make profit instead. A quick look at the company’s income statement shows us where: 1) Stock-based compensation, or stock awards given to employees as part of their salary; 2) research and development; and 3) sales and marketing. Twitter made notable cuts to all three categories in the past year.

Twitter spent just over $102 million on stock-based compensation in Q4, down from $138 million the year earlier. That’s a 26 percent decrease.

Twitter also spent just $134 million on research and development, down from $202 million the year prior. That includes a decrease of roughly $26 million in stock-based compensation for R&D employees, folks like engineers and designers who work on Twitter products. If you take out stock-based compensation entirely (it’s already accounted for above), Twitter’s R&D budget went from $120.3 million in 2016 to $78.3 in 2017 — a decrease of roughly 35 percent.

Twitter also spent almost $70 million less on sales and marketing in Q4 2017 than it did in the same quarter in 2016 — that means spending less on things like agency help, conferences and events for the company. Excluding stock-based compensation for sales and marketing employees, Twitter’s sales and marketing budget went from roughly $233 million in 2016 to $163.5 million in 2017 — a decline of almost 30 percent.

Taken in aggregate, those changes help explain the bulk of Twitter’s turnaround.

Talk to the folks at Twitter and they will point out that cost cuts weren’t the only reason the company turned a profit.

Twitter claims its business is stronger than it looks on paper — that 2 percent revenue growth would have been 8 percent growth if you ignore the fact that some of Twitter’s 2016 revenue came from now-defunct marketing platform Tellapart, which it shuttered in early 2017. (Of course, shuttering Tellapart also helped with the cost-cutting, too.)

The bottom line is that Twitter achieved profitability by getting smarter about its spending.

Don’t expect that profit margin to soar. “We’re investing to make 2018 a year of growth and expect our expenses to more closely align with revenue after a year of significant margin improvement,” CEO Jack Dorsey said on Thursday’s call.

That roughly translates to a promise from Twitter to spend what it makes this year.

One quarter of profitability down. Now it’s up to Twitter’s revenue business to keep it going.

Sign up for the newsletter Recode Daily Email (required) By signing up, you agree to our Privacy Notice and European users agree to the data transfer policy. Subscribe