Microsoft Corp. continued its rebirth as a force in cloud-computing, posting stronger-than-expected gains in its business of selling web-based services to corporate customers.

The software giant has been working to expand the business selling web-based services to corporate customers, and now has solidified its spot as the No. 2 provider of on-demand computing processing and storage behind market pioneer Amazon.com Inc. In its fiscal fourth quarter, Microsoft notched gains in its Azure cloud-computing business and Office...