Just a few years ago, Microsoft was seen as a lumbering has-been of the technology world.
It was big and still quite profitable, but the company had lost its luster, failing or trailing in the markets of the future like mobile, search, online advertising and cloud computing. Its stock price languished, inching up 3 percent in the decade through the end of 2012.
It’s a very different story today. Microsoft is running neck and neck with Apple for the title of the world’s most valuable company, both worth more than $850 billion, thanks to a stock price that has climbed 30 percent over the past 12 months.
So what happened?
There is a short-term explanation for Microsoft’s market rise, and there is a longer-term one.
The near-term, stock-trading answer is that Microsoft has held up better than others during the recent sell-off of tech company shares. Apple investors are worried about a slowdown in iPhone sales. Facebook and Google face persistent attacks on their role in distributing false news and conspiracy theories, and investor concerns that their privacy policies could scare off users and advertisers.
But the more enduring and important answer is that Microsoft has become a case study of how a once-dominant company can build on its strengths and avoid being a prisoner of its past. It has fully embraced cloud computing, abandoned an errant foray into smartphones and returned to its roots as mainly a supplier of technology to business customers.
That strategy was outlined by Satya Nadella shortly after he became chief executive in 2014. Since then, Microsoft’s stock price has nearly tripled.
Microsoft’s path to cloud computing — processing, storage and software delivered as a service over the internet from remote data centers — was lengthy and sometimes halting.
Its forerunners to cloud computing go back to the 1990s, with Microsoft’s MSN online service and later its Bing search engine. In 2010, four years after Amazon entered the cloud market, Microsoft introduced its cloud service. But it did not have an offering comparable to Amazon’s until 2013, analysts say.
Even then, Microsoft’s cloud service was a side business. The corporate center of gravity remained its Windows operating system, the linchpin of the company’s wealth and power during the personal computer era. That changed after Mr. Nadella replaced Steven A. Ballmer, who had been chief executive for 14 years.
Mr. Nadella made the cloud service a top priority, and the company is now a strong No. 2 to Amazon. Microsoft has nearly doubled its share of that market to 13 percent since the end of 2015, according to the Synergy Research Group. Amazon’s share has held steady at 33 percent over that span.
Microsoft has also retooled its popular Office apps like Word, Excel and PowerPoint in a cloud version, Office 365. That offering caters to people who prefer to use software as an internet service and gives Microsoft a competitive entry against online app suppliers like Google.
The financial payoff from the shift came gradually at first, but is accelerating. In the year that ended in June, Microsoft’s revenue rose 15 percent, to $110 billion, and operating profit increased 13 percent, to $35 billion.
“The essence of what Satya Nadella did was the dramatic shift to the cloud,” said David B. Yoffie, a professor at the Harvard Business School. “He put Microsoft back into a high-growth business.”
It is the perception that Microsoft is on a high-growth track that has fueled its rising share price.
When Microsoft acquired Nokia’s mobile phone business in 2013, Mr. Ballmer hailed the move as a “bold step into the future.” Two years later, Mr. Nadella walked away from that future, taking a $7.6 billion charge, nearly the entire value of the purchase, and shedding 7,800 workers.
Microsoft would not try to compete with the smartphone technology leaders, Apple, Google and Samsung. Instead, Microsoft focused on its developing apps and other software for business customers.
Microsoft does have a successful consumer franchise in its Xbox video game business. But it is a separate unit, and though it generates revenue of $10 billion, that is still less than 10 percent of the company’s overall sales.
Microsoft products, in the main, are about utility — productivity tools, whether people use them at work or at home. And its Azure cloud technology is a service for businesses and a platform for software developers to build applications, a kind of cloud operating system.
Mr. Nadella’s big acquisitions have been intended to add to its offerings for business users and developers. In 2016, Microsoft bought LinkedIn, the social network for professionals, for $26.2 billion.
“It’s really the coming together of the professional cloud and the professional network,” Mr. Nadella explained at the time.
This year, Microsoft paid $7.5 billion for GitHub, an open software platform used by 28 million programmers.
Under Mr. Nadella, Microsoft has loosened up. Windows would no longer be its center of gravity — or its anchor. Microsoft apps would run not only on Apple’s Macintosh software but on other operating systems as well. Open source and free software, once anathema to Microsoft, was embraced as a vital tool of modern software development.
Mr. Nadella preached an outward-looking mind-set. “We need to be insatiable in our desire to learn from the outside and bring that learning into Microsoft,” he wrote in his book “Hit Refresh,” published last year.
The company’s financial performance — and its stock price — suggest that the Nadella formula is working.
“The old, Windows-centric view of the world stifled innovation,” said Michael A. Cusumano, a professor at the Massachusetts Institute of Technology’s Sloan School of Management. “The company has changed culturally. Microsoft is an exciting place to work again.”