Microsoft is on cloud nine.

The technology company's big bet on cloud computing is paying off. Sales from Microsoft's cloud division hit $6.7 billion in the most recent quarter, a 7% gain from the same quarter a year earlier. That was fueled by the staggering growth of Azure, its cloud computing platform, which more than doubled.

Microsoft (MSFT) says it's now on pace to generate more than $12 billion in sales annually from commercial cloud services.

The momentum from Microsoft's cloud efforts helped the company reach $22.6 billion in sales and $5.5 billion in net income for the quarter, beating Wall Street estimates on both counts.

Its stock was up as much as 4% in after hours trading following the release.

"The Microsoft Cloud is seeing significant customer momentum and we're well positioned to reach new opportunities in the year ahead," Microsoft CEO Satya Nadella said in a statement.

Related: Microsoft's privacy victory: Feds can't get emails stored in Ireland

Microsoft has invested heavily to reposition itself as an industry leader in cloud services, rivaling businesses like Amazon (AMZN). This has helped Microsoft cushion the blow from a failed investment in smartphones and a sagging PC market dragging down its Windows licensing sales.

Revenue from phones declined by 71% from the same quarter a year earlier. Microsoft also wrote down a $1.1 billion charge related to the fallout from its purchase of Nokia and subsequent restructuring in the phone division. Last year, it took a $7.6 billion charge for the Nokia deal.

While its cloud performance has been strong, the performance of Windows 10 has been less than it hoped for.

Microsoft admitted last week that it will miss an ambitious goal to have Windows 10 running on one billion devices by 2018 as a result of slower-than-expected upgrades and adoption.