What happened

Microsoft (NASDAQ:MSFT) shares have gained nearly 18% since the beginning of this year, according to data provided by S&P Global Market Intelligence, after the company beats analysts' earnings estimates three times.

So what

Investors optimism for Microsoft's stock first surged after the company reported its second-quarter 2017 earnings at the end of January. Analysts had expected earnings per share (EPS) of $0.79, but Microsoft delivered $0.83 on $26.07 billion in revenue. 

Surface Book on a table.

Image source: Microsoft.

That help boost the company's share price over the short term, though the stock later retreated. But investors continued to push up Microsoft's shares in the months leading up to its third-quarter results. Microsoft missed its revenue guidance in the third quarter and Surface revenue fell by 26% year over year, but investors were pleased that the company's EPS came in at $0.73, above analysts' consensus estimate of $0.70. 

That investor optimism was rewarded in Microsoft's fourth-quarter results. The company beat analysts' revenue and earnings estimates, with adjusted EPS coming in at $0.98 versus the consensus of $0.71, and revenue of $24.7 billion versus estimates of $24.2 billion. 

Now what

Microsoft investors appear to be buying into the company's new narrative around cloud computing and its more modern subscription model for doing business. The company is already proving that that may be a smart bet, as Microsoft boosted its Intelligent Cloud revenue by 11% in the fourth quarter. Microsoft is still reinventing itself with its latest Surface products, cloud-based Office software, and its cloud computing business -- and its pursuits appear to be paying off for shareholders this year.

Teresa Kersten is an employee of LinkedIn and is a member of The Motley Fool's board of directors. LinkedIn is owned by Microsoft. Chris Neiger has no position in any stocks mentioned. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.