Microsoft (MSFT -1.30%) is back on top of the tech world these days, but it's easy to forget that the company was left in the hinterlands for much of this century. While Microsoft was an early pioneer in personal computing with operating systems like DOS and then Windows, it missed the mobile transition, falling behind Apple after the iPhone was released.

A decade ago, Microsoft was regarded as a laggard in technology, known for a lack of innovation and underperforming the stock market, though it continued to generate profits from its entrenched personal computing and enterprise software ecosystem.

However, its legacy of underperformance changed when Satya Nadella took over as CEO nearly 10 years ago on Feb. 4, 2014.

Microsoft's logo and name.

Image source: Getty Images.

Nadella overhauled Microsoft philosophically and strategically. He ended the company's war against Apple, allowing Microsoft Office products to be used on Apple devices. Nadella also invested heavily in Microsoft Azure, the company's cloud infrastructure business, which has grown to become the company's biggest profit driver. Azure is now the second-largest cloud infrastructure business behind Amazon Web Services, though it's growing significantly faster than its larger rival.

The Microsoft chief has made key acquisitions like LinkedIn, GitHub, and Activision Blizzard, diversifying the company and strengthening its pipeline upstream and downstream in areas like advertising and open-source code development. However, Nadella's biggest coup now seems to be the partnership he forged with OpenAI, of which Microsoft now owns nearly 50%. That partnership has made Microsoft a leader in generative artificial intelligence (AI), and OpenAI's technology has been incorporated across a range of products including Azure, its Office software suite, Bing search, and others.

That's helped make Microsoft a winner in 2023, and since Nadella took over, the stock gained 934%, outperforming the S&P 500 by a wide margin as the chart below shows.

MSFT Chart

MSFT data by YCharts

According to those results, $10,000 invested in Microsoft when Nadella took the helm would now be worth $123,000 with dividends reinvested or $103,400 without dividends. That would give you a compound annual return of 29% with dividends reinvested or 27% without, which is roughly triple the historical average of the S&P 500 with dividends reinvested. That's a pretty stellar track record over a decade.

By comparison, Microsoft stock increased just 34% in the decade before then, which compared to a 55% gain in the S&P 500 as that decade included the crash during the financial crisis.

Where will Microsoft go over the next decade?

Nadella's record as Microsoft's CEO shows the power of a CEO to breathe new life into a company. The CEO is ultimately responsible for corporate strategy, capital allocation, and other key decisions, and a bad CEO like predecessor Steve Ballmer can be equally damaging.

Leadership could be especially important these days in the tech industry as the AI revolution takes off. Though each company competing in the generative AI race comes with a different set of strengths, the choices and investments that CEOs like Satya Nadella are making could make a difference in billions of profits over the long term.

Nadella has also succeeded in making Microsoft much more resilient than it was a decade ago thanks to the growth of its Azure cloud infrastructure business, the integration of its Office suite in Apple products, and acquisitions like LinkedIn and GitHub. That diversification also gives the company an advantage over its big tech rivals as it can deploy new generative AI across a wide range of products.

Is Microsoft stock a buy?

Microsoft stock jumped more than 50% in 2023, and its valuation has gotten a bit expensive at a price-to-earnings ratio of 36.

However, Microsoft executed effectively in 2023, and it strengthened its competitive advantages by incorporating its new AI Copilot into a wide range of products, including its office productivity software.

Demand for those products should continue to ramp up in 2024, and Microsoft investors are in good hands with Nadella -- especially as the company continues to leverage its partnership with OpenAI, which also gives it an edge in AI.

Although the stock might be pricey, Microsoft's stock still looks like a smart buy in 2024.