Microsoft (MSFT 0.26%) is feeling the pressure from a slowing global economy. The software giant recently announced that sales growth fell to its weakest rate in years amid declining earnings.

Yet Microsoft shareholders still have good news to celebrate, both for 2023 and beyond. The company's cloud business is growing at a solid clip, cash flow is strong, and Microsoft has a prime position in emerging industries like AI.

With that bigger picture in mind, let's look at whether Microsoft stock is still a buy in early 2023.

The pandemic boom is over

It was clear from Microsoft's recent operating update that its growth trend has hit a weaker level. Sales inched higher by just 2% (to $52.7 billion) in the selling period that ended in late December. Sure, that figure rises to 7% after one accounts for currency exchange rate swings. But Microsoft was growing at a year-over-year rate of over 50% in the early phases of the pandemic and recovery.

Parts of the portfolio performed better than others. Microsoft's Azure cloud business is still expanding quickly, helping offset declines in the video game and personal computing divisions. The biggest concern for investors is that it's only a matter of time before enterprises pull back on spending more aggressively, too.

Keeping profits up

Microsoft continues to flex its financial muscles, though. In its fiscal year 2023 Q2 report, Microsoft's gross profit margin rose and operating profit declined by 4 percentage points. However, at 40%, the operating profit margin remains elevated. The company generated a hefty $11 billion of operating cash in the three month period, which ended Dec. 31, compared to $14.5 billion a year ago during the same period. "We are focused on operational excellence as we continue to invest to drive growth," CFO Amy Hood said in a press release.

This strong cash flow is doing more than simply funding Microsoft's growth initiatives. The company returned $5.1 billion to shareholders in dividend payments, up from $4.7 billion a year ago. Combined with stock buybacks, total cash returns this quarter were over $10 billion. Shareholders can be reasonably confident that these capital moves will cushion their returns even if slowing economic growth trends don't quickly improve.

Microsoft stock is still a buy

While Wall Street worries about weaker growth ahead in 2023, smart investors can look past those concerns toward the excellent returns that are likely for those holding Microsoft stock over the long term.

The business has a uniquely large and diverse sales footprint that includes exposure to attractive niches like cloud services, cybersecurity, personal computing, and video games. It is rare that all these areas boom at the same time, as they did in late 2021 and through the first half of 2022.

Instead, investors can expect some segments of Microsoft's business to offset weaknesses in others. In the meantime, shareholders can look forward to the tech giant investing aggressively in growth areas like AI while returning excess cash through stock buybacks and a growing dividend payout.

Sure, Microsoft might not ever again post a stretch of 20% year-over-year quarterly sales gains as it did in 2021. But this growth stock is still likely to be a great holding in an investor's diversified portfolio.