The technology giant said its loss for the quarter to December 31 was USD 6.3 billion -- as it took a charge of USD 13.8 billion to pay its taxes.
Revenue for Microsoft's fiscal second quarter rose 12 per cent to USD 28.9 billion as it saw gains in business services and cloud computing.
Once the world's largest technology company, Microsoft has been rebooting as consumers shift away from Windows- powered computers to mobile devices.
"This quarter's results speak to the differentiated value we are delivering to customers across our productivity solutions and as the hybrid cloud provider of choice," said Microsoft CEO Satya Nadella.
More From This Section
"Our investments in IoT, data, and AI services... position us to further accelerate growth."
Microsoft shares rose 2.45 per cent in after-hours trade to USD 95.01 as investors welcomed the results.
"Microsoft just keeps on trucking, showing success in modern business transformation," said Patrick Moorhead of Moor Insights & Strategy.
Like other big multinationals, Microsoft is repatriating a large portion of its overseas cash holdings to take advantage of a favorable tax rate under the reforms championed by President Donald Trump and approved last year by Congress.
Microsoft has more than USD 130 billion overseas, and its repatriation will trigger a US tax bill estimated at USD 13.8 billion.
The new bill implements a tax rate of 15.5 per cent compared with a possible 35 per cent rate under prior law.
Analyst Trip Chowdhry of Global Equities Research has been upbeat on Microsoft, predicting strong results earlier this month for the tech giant, largely due to its Azure cloud division which manages systems for companies and government agencies and competes against services from Amazon, Google and others.
"Enterprise IT budgets are opening up, and Microsoft is benefiting from overall improving IT spend," Chowdhry said in a research note.