What happened

Shares of Twilio (TWLO 1.08%), a company that provides cloud-based communication tools and services for developers, surged on Thursday. The stock shot up as much as 20.7%. As of 2:10 p.m. ET, the stock was up 18.3%.

The tech stock's gain follows the company's fourth-quarter earnings report, which included better-than-expected revenue and adjusted earnings per share. In addition, the company's announcement of a 17% reduction to its workforce and a $1 billion share repurchase program are likely encouraging Wall Street as well.

So what

Twilio said its fiscal fourth-quarter revenue rose 22% year over year to $1.02 billion. This beat analysts' average forecast for revenue of $1 billion. In addition, the company's non-GAAP (generally accepted accounting principles) earnings per share swung from a loss of $0.20 in the year-ago quarter to a profit of $0.22. Analysts were expecting an adjusted loss per share of $0.09.

Perhaps more important to investors than these financial results was Twilio's move to restructure its business and revisit its capital allocation strategy. In addition to announcing a workforce reduction and a share buyback program, the company said it transitioning to a business unit structure. One unit will focus on communications and the other will work on data and applications.

Management explained the reasoning for unit structure in the company's fourth-quarter earnings release:

This strategic realignment enables Twilio to better execute on the key priorities for each business -- driving efficiencies for Twilio Communications and accelerating growth for Twilio Data & Applications -- while taking into consideration each business unit's unique economic, customer, and product needs.

Now what

Looking ahead, Twilio said it expects first-quarter revenue to be between $995 million and $1 billion. This represents 14% to 15% year-over-year growth. Further, management said it expects non-GAAP earnings per share between $0.18 and $0.22. Analysts, on average, were expecting revenue slightly above Twilio's forecast.

But the company's profitability guidance was better than expected, as the current consensus analyst forecast called for adjusted earnings per share of $0.01.