Microsoft CEO Satya Nadella delivers the keynote address during the 2016 Microsoft Build Developer Conference on March 30, 2016 in San Francisco, California Microsoft said Tuesday it posted a profit of $3.1 billion in the just-ended quarter, swinging into the black a year after hefty charges from writing off mobile phone assets.
"This past year was pivotal in both our own transformation and in partnering with our customers who are navigating their own digital transformations," said chief executive Satya Nadella.
The profit in the tech giant's fourth fiscal quarter was nearly identical to the loss from a year earlier, when it took charges of more than $7 billion to reflect the lower value of the Nokia mobile phone division it had acquired.
Revenue dipped to $20.6 billion from $22.2 billion in the same period a year ago.
Overall, the results were better than most forecasts and sparked an after-hours gain of more than three percent for the company, which is seeking to shift its emphasis to cope with declining sales of personal computers.
Under Nadella, Microsoft is trying to reduce its dependence on software sales, and boost its role in services and cloud computing, with some contributions from its Xbox gaming platform and Surface tablets.
Nadella said in a statement that "the Microsoft Cloud is seeing significant customer momentum and we're well positioned to reach new opportunities in the year ahead."
Microsoft closed out its fiscal year with a 38 percent rise in profit to $16.8 billion.
Over the past quarter, Microsoft boosted revenue in its "Productivity and Business Processes" unit which includes Office, the software suite which has been largely moved to the internet cloud.
The company's "Intelligent Cloud" operations also grew, driven by revenue growth from Azure, Microsoft's platform for business cloud computing.
It saw a slight drop in revenue from the "More Personal Computing" division, which includes the Windows operating system as well as devices such as Surface.
Microsoft, which has for the most part dropped its smartphone business, said phone revenue slid 71 percent from a year ago, while Surface saw a nine percent revenue gain from the release of Surface Pro 4 and Surface Book.
Sales of gaming revenue decreased nine percent, amid lower Xbox sales, but that was offset by gains from its Xbox Live subscription service.
Microsoft said its search advertising revenue rose 54 percent from a year ago, helped by the use of Bing, the primary search engine for Windows 10.
Explore further: Microsoft earnings slip but still beat forecasts (Update)