By Aaron Tilley

Microsoft Corp. reported strong sales growth driven by sustained demand for its cloud-computing services as customers shift more work online during the coronavirus pandemic.

The software maker on Wednesday said sales rose 13% to $38 billion in its fiscal fourth quarter, and that it generated a net profit of $11.2 billion. Both measures for the June-ended period topped Wall Street expectations.

Sales for Azure, Microsoft's closely watched cloud-computing service, grew by 47% from a year earlier. The business notched 59% growth in the preceding period and 64% in the year-earlier quarter.

"The last five months have made it clear that tech intensity is the key to business resilience. Organizations that build their own digital capability will recover faster and emerge from this crisis stronger," Microsoft chief Satya Nadella said.

For the current quarter Microsoft guided generating between $35.15 billion and $36.05 billion in sales, in line with analysts' expectations of $35.87 billion.

Shares in Microsoft fell more than 2% in after-hours trading. The shares have gained about 34% so far this year, compared with a 5% decline in the Dow Jones Industrial Average.

In the fourth quarter Microsoft's intelligent-cloud segment, which includes its Azure service, booked revenue of $13.37 billion, up 17% from a year earlier.

Revenue rose 6% to $11.75 billion for its productivity and business process division, which includes LinkedIn, sales-management software Dynamics and commercial subscriptions to the Office 365 product suite.

Microsoft's personal computing business -- which includes licensing revenue from PC sales, the Xbox gaming platform and Surface laptops -- saw sales advance 14% to $12.91 billion. The gaming content business drove the growth in a 65% jump in sales over the previous year. The business is also expected to get a boost later this year when it releases its new Xbox Series X gaming console.

Wall Street was hoping to see better performance on margins, Azure and the productivity business, said Jefferies analyst Brent Thill. "You saw a surge in demand but that demand is starting to level off a bit," Mr. Thill said of the boost to Microsoft's cloud business in the early months of the pandemic.

The decline in Microsoft's profit margin in the latest period reflected investments in increasing its cloud capacity, giving out free trials of software and offering flexible financing options for customers' struggling with slowdowns in their business, said finance chief Amy Hood on an earnings call. Microsoft said the pandemic has hurt small and medium-size businesses and their spending on Office and Windows software in recent months and it expects that to continue in the current quarter.

Cloud-computing was a winner early in the pandemic, as companies embraced working from home and the tools that enabled such operations. But some cloud customers also have been looking to cut costs as they grapple with the effects of the economic downturn from the coronavirus outbreak. IBM said earlier this week cloud-computing revenue rose 30% to $6.3 billion in its second quarter.

Microsoft's cloud rivals Amazon.com Inc., which has the largest industry market share, and Alphabet Inc.'s Google report earnings next week. Microsoft said revenue from its commercial cloud operations surpassed $50 billion for the first time ever in the latest fiscal year.

Even as the pandemic has fueled demand for certain products -- including its Teams workplace-collaboration software, it also has forced Microsoft to adapt. The Redmond, Wash.-based company was early in shifting employees to remote working when Covid-19 cases spread across the U.S.

More recently, Microsoft said it would close all of its more than 80 bricks-and-mortar retail stores and concentrate on online sales. The company recorded a $450 million charge in its latest quarter from the retail store closures.

And LinkedIn, which it acquired for more than $26 billion in 2016, is dealing with weakened demand for its recruitment services and soft advertising spending during the pandemic. Though LinkedIn revenue grew 10% in the most recent quarter, the company said earlier in the week that it would cut about 960 jobs, or around 6% of the unit's workforce.

Microsoft said Teams has been a success during the pandemic, but the product has drawn scrutiny from competitors. Slack Technologies Inc., a business chat software rival, filed a complaint with the European Union's competition regulator on Wednesday, claiming that Microsoft unfairly bundled Teams free with its Office 365 suite of business-productivity apps. Slack is asking the European regulator to force Microsoft to sell Teams as a stand-alone product. In response, Microsoft said it is committed to providing customers a variety of choices and that it looks forward to providing additional information to the regulator.

Meanwhile, Microsoft shifted policies in the face of the public outcry about police brutality and racial inequality sparked by the killing of George Floyd. It has suspended the sale of facial-recognition technology to police forces in the U.S. until there is a national law regulating its use.

Write to Aaron Tilley at aaron.tilley@wsj.com