Microsoft posted its second-quarter 2016 earnings report Thursday, and shareholders had reason to be pleased. Overall revenue beat analysts' forecasts, and Surface sales in particular saw a sharp rise, pushed by the Surface Book and Surface Pro 4. Office 365 nearly doubled its revenue and increased its consumer subscriber count, while Azure cloud sales were up 140 percent.

Microsoft posted earnings per share of $0.78, beating analyst expectations of $0.71. The company also posted $25.69 billion in revenue, surpassing analysts' revenue estimate of $25.26 billion. Net income was $6.3 billion. In the same quarter last year, Microsoft posted earnings per share of $0.71, revenue of $26.5 billion and net income of $5.86 billion.

The company stock was at $55.50 in early after-hours trading, up 6.62 percent from market close at $52.06.

“Businesses everywhere are using the Microsoft Cloud as their digital platform to drive their ambitious transformation agendas,” said Satya Nadella, chief executive officer at Microsoft, in a statement. “Businesses are also piloting Windows 10, which will drive deployments beyond 200 million active devices.”

Productivity and Business Processes, which includes Office 365, declined 2 percent in revenue, in line with guidance. The operating unit made $6.7 billion in revenue, with Microsoft's prior guidance estimating around $6.6 billion to 6.7 billion.

Office 365 revenue grew nearly 70 percent, a sign of Microsoft's success at diversifying away from Windows. "They used to depend on trapping you in the ecosystem with their operating system, and they've transcended that," said Kim Forrest, VP and senior equity analyst at Fort Pitt Capital Group.

Intelligent Cloud, which includes the Azure cloud computing platform, grew 5 percent to $6.3 billion. In its prior guidance, Microsoft estimated around $6.2 billion to 6.3 billion revenue. Azure revenue alone grew a whopping 140 percent.

Sales in Microsoft's personal computing group declined 5 percent to $12.7 billion, beating prior guidance that estimated around $12 billion to $12.4 billion in revenue. The unit includes Windows 10, Bing and the Surface line of tablets. Surface revenue grew by 29 percent year over year. "I've always seen Surface as the showcase of what [Windows 10] hardware can do," said Forrest.