Microsoft stock fell briefly, rebounded and later surged on guidance on Thursday after the company announced strong earnings for the fourth quarter of its 2018 fiscal year, which ended on June 30.

Here's how the company did:

Earnings: $1.13 per share, excluding certain items, vs. 1.08 cents per share as expected by analysts, according to Thomson Reuters.

$1.13 per share, excluding certain items, vs. 1.08 cents per share as expected by analysts, according to Thomson Reuters. Revenue: $30.09 billion, vs. $29.21 billion as expected by analysts, according to Thomson Reuters.

Microsoft chief financial officer Amy Hood told analysts on Thursday's earnings call that the company expects $27.35 billion to $28.05 billion in revenue. According to Thomson Reuters, analysts had expected Microsoft to forecast $27.38 billion in revenue, below the midpoint of the guidance.

Microsoft stock shot up to more than 4 percent above the closing price of $104.40.

As a whole, Microsoft grew revenue by 17 percent, according to a statement.

In recent years CEO Satya Nadella has focused investor attention around the Commercial Cloud, a group of products including commercial tiers of the Office 365 productivity software, Dynamics 365 business software and the Azure public cloud. Commercial Cloud brought Microsoft $6.9 billion in revenue, up 53 percent. That's down sequentially from about 58 percent growth. In a Tuesday note, KeyBanc Capital Markets analysts led by Brent Bracelin had estimated that Commercial Cloud would grow by 46 percent.

Microsoft, as usual, did not disclose exact revenue from Azure, but did say that it rose by 89 percent. The KeyBanc analysts had estimated that Azure on its own would yield $2.05 billion of the Commercial Cloud revenue, with 80 percent year-over-year-growth, down sequentially from 93 percent growth in the previous quarter. Analysts at Raymond James and Stifel also predicted 80 percent growth for Azure in recent days, while Credit Suisse analysts were more optimistic, looking for 84 percent growth.

"The law of large numbers is kicking in," Evercore ISI analyst Kirk Materne told CNBC in an interview, referring to Azure's growth. "The base is getting bigger. It is growing faster than AWS did when it was at a similar size. This is probably a $9 billion business growing at more than 80 percent."