Microsoft's bet on the cloud helped propel the company to its first $100 billion sales year.

Microsoft (MSFT) said Thursday that it posted $110 billion in sales for the 2018 fiscal year ending in June, a 14% increase over the prior year. CEO Satya Nadella credited "early investments" in cloud services for the results.

The company's commercial cloud business hit $6.9 billion in the last quarter, jumping 53% from the same period last year. That helped push Microsoft's overall quarterly sales to $30.1 billion, a 17% increase from a year ago.

Under Nadella's leadership, Microsoft shook up internal operations to prioritize the cloud and demote its legacy business, Windows. The shift placed Microsoft near the front of rapidly growing technology segment after years of struggling to compete in smartphones and online services like search.

Microsoft overtook Google (GOOGL) in public cloud market share in 2016 and now ranks second only to Amazon (AMZN), according to data from Synergy Research Group.

Related: Walmart and Microsoft team up to fight Amazon

"It's no longer a three-horse race," says Brad Reback, an analyst who tracks Microsoft at Stifel. "It's Microsoft and Amazon, with Google a distant third."

In a clear jab at Amazon, Microsoft recently signed a five-year cloud services deal with Walmart (WMT). The agreement should help both companies take on Amazon.

It's a big market to dominate. Global spending on public cloud services and infrastructure is expected to hit $160 billion this year and reach $277 billion by 2021, according to projections from IDC.

Microsoft's traction in this market has catapulted its stock to all-time highs this year. Morgan Stanley analysts predicted in March that cloud computing could push Microsoft to a $1 trillion market cap, joining Apple (AAPL) and Amazon in the race to that astronomical figure.

Microsoft's stock ticked up 4% in after hours trading Thursday following the earnings report.