Technology stocks have regained their mojo in 2023 amid cooling inflation and there are indications that the Federal Reserve could be looking to pause its increases in interest rates.

These two factors weighed heavily on tech stocks last year as investors pulled their money out of richly valued companies and looked for safer investment pastures. However, the Nasdaq-100's jump of 18% this year shows that investors have regained confidence in the tech sector. What's more, history suggests that major stock indices such as the Nasdaq could head higher as the year progresses.

That's why now looks like a good time for investors to buy shares of Microsoft (MSFT -0.18%), a tech stock that has been in fine form this year. Here's a closer look at why the company is worthy of consideration.

Microsoft weathers PC market weakness

A $1,000 investment made in Microsoft five years ago is now worth almost $3,300, assuming the dividends were reinvested. That translates into an average annual return of nearly 27%. Investors can expect such solid returns from Microsoft in the future as well, thanks to fast-growing markets the company is involved in such as cloud computing and generative artificial intelligence (AI).

The software giant is currently in recovery mode after struggling in the first half of the current fiscal year on account of weak personal computer (PC) sales. Its revenue was up 7% year over year to $52.9 billion in the third quarter of fiscal 2023 (for the three months ended March 31). Microsoft's non-GAAP (generally accepted accounting principles) earnings increased 10% year over year to $2.45 per share. Robust growth in the company's productivity and cloud businesses was enough to offset the 9% year-over-year revenue drop in the personal computing business, which produced a quarter of the company's top line last quarter.

But given the influence of the PC business on Microsoft's top line and the prevailing headwinds in the segment, analysts expect Microsoft's revenue to increase only 5% for the full fiscal year to $208.7 billion. Earnings are also expected to improve only slightly to $9.33 per share from $9.21 per share in fiscal 2022. However, Microsoft stock has rallied 23% so far this year despite the headwinds it's facing. That's not surprising, as the company's growth is expected to pick up from fiscal 2024.

MSFT EPS Estimates for Current Fiscal Year Chart

MSFT EPS Estimates for Current Fiscal Year data by YCharts

Why the slump shouldn't last for long

There are a few simple reasons why Microsoft's growth is set to accelerate. For instance, spending on public cloud services is expected to grow at a nice clip in 2023 and 2024. Gartner estimates that $597 billion will be spent on public cloud services globally this year, up nearly 22% from last year's levels. The market research firm expects the impressive growth to continue in 2024 with another 21% increase in worldwide public cloud spending to $724.5 billion.

Microsoft's 23% share of the cloud infrastructure services market puts it in position to make the most of this huge growth opportunity and help sustain the healthy pace at which its cloud business is growing. More specifically, the company reported 18% year-over-year growth in revenue from its intelligent cloud business segment in the last reported quarter to $21.5 billion. As the segment produced 40% of Microsoft's top line, the solid growth prospects of the cloud business bode well for the company's future growth.

On the other hand, the adoption of generative AI applications -- such as ChatGPT -- could give Microsoft's business a big shot in the arm. The company has reportedly invested $13 billion in ChatGPT creator OpenAI. Microsoft has already started monetizing generative AI in the form of a paid ChatGPT subscription. Even better, Microsoft is using generative AI to make services such as its Bing search engine and Office 365 collaborative tools better.

With the generative AI market set to clock 34% annual growth through 2030, per Grand View Research, Microsoft is setting itself up to make the most out of this nascent technology. As such, it won't be surprising to see this potential AI winner continue soaring.

And it isn't too late for investors to buy the stock, as Microsoft is trading at 32 times trailing earnings, a small discount to its five-year average earnings multiple of 34. But it could get expensive, as the rally seems here to stay thanks to the multiple growth drivers mentioned. This is why it would be a good idea for investors to buy the stock before it explodes higher.