Microsoft (MSFT -0.82%) has had an epic run so far in 2023, driven higher by the general recovery of the technology sector amid a broader market rally. Shares of the cloud computing and software specialist have gained 38% year to date (as of this writing), nearly triple the 13% gains of the S&P 500. This is in stark contrast to its performance in 2022, when the stock plunged by nearly 29%.
This remarkable comeback was driven by a combination of factors. While Microsoft's solid financial results no doubt fueled its rebound, it was the company's quick pivot to embrace generative artificial intelligence (AI) that kicked the stock into overdrive. This has given investors confidence that the company is well positioned to participate in the broader market recovery and the massive opportunity of AI.
What does this mean for investors who sat out the run-up in Microsoft's stock price? Should they buy now in anticipation of additional gains to come or stay away from the stock because of its somewhat pricey valuation and the persistent downturn in the personal computer (PC) market?

Image source: Getty Images.
What weighed on Microsoft's stock over the past year?
Even the hardiest of businesses felt the impact of the complex macroeconomic conditions of 2022, and Microsoft was among them. The company was perhaps hardest hit by the unusually deep slump in PC sales.
Worldwide PC shipments tumbled by 28% year over year in the fourth quarter of 2022, according to market analyst Gartner, marking the steepest such decline since the mid-1990s. Historically, nearly one-third of Microsoft's revenue has come from the company's "more personal computing" segment, which suffered from the decline in consumer discretionary spending -- a decline that still lingers.
During its fiscal 2023, which ended June 30, revenue from that segment declined 9%, dragging down the company's overall results. To put those results in context, the productivity and business processes segment and the intelligent cloud segment grew revenue by 9% and 17%, respectively, during the period.
The good news is that the PC market's slide may finally be nearing the bottom. Many consumers ponied up for new PCs early during the pandemic, and those devices are now heading toward the end of their useful lives. The refresh cycle is expected to begin in earnest in 2024, which will eliminate a major headwind from Microsoft's business.
What (else) could drive Microsoft stock higher?
Aside from a resurgence in demand within the PC market, there are other catalysts that could boost the ongoing rally for Microsoft stock.
There's little question that generative AI could represent the biggest of those opportunities as Microsoft looks to capitalize on the billions of dollars it has invested in ChatGPT creator OpenAI. The company recently introduced Microsoft 365 Copilot, which pairs with the company's suite of workplace tools "to turn your words into the most powerful productivity tool on the planet." By automating repetitive or recurring tasks, Copilot helps boost productivity even more.
Microsoft plans to charge subscribers $30 per user per month, on average, for access to Copilot. Some on Wall Street calculate the company's AI-related innovations could generate incremental revenue of $100 billion annually by 2027.
Then there's Microsoft Azure -- the world's second-largest cloud infrastructure service. Microsoft is well positioned to continue its growth, and it's within striking distance of being able to challenge Amazon Web Services (AWS) for the crown. Microsoft currently controls 23% of the market and has been gaining ground on AWS, which controls 32%, according to technology researcher Canalys. Microsoft can offer its generative AI tools to its many existing cloud users, as well as to those that subscribe to its software-as-a-service (SaaS) offerings.
Microsoft wasted no time in seeking to monetize its AI investment, integrating these latest tools across its broad software empire.
How to approach Microsoft stock now
Microsoft isn't the screaming bargain it was just a few months ago, as investors have begun to price the value of the company's foray into AI into the stock. It's currently trading for 30 times forward earnings, compared to a price-to-earnings ratio of 25 for the S&P 500. While some might balk at paying such a premium for Microsoft, I'd argue that's a pretty reasonable multiple for a company with a treasure trove of recurring revenue sources, and that has positioned itself at the forefront of the AI revolution.
Furthermore, Microsoft is expected to increase its revenues and earnings per share by double-digit percentages between now and 2024.
Given the numerous catalysts that could fuel Microsoft's stock price and the company's world-class suite of productivity tools, now's the time to buy the stock if you haven't already -- even if its price is a little frothy.