Apple’s month of discontent ended Friday with the company surrendering the title of most valuable American company to what had once been its biggest rival: Microsoft.

By the time the stock market closed, Microsoft’s shares had risen 0.6 percent, to end November at $110.89, and give it a market capitalization of $851.2 billion. By contrast, Apple shares were trimmed by 0.5 percent, to finish the month at $178.58, and left the iPhone maker’s market value at $847.4 billion.

A company’s market capitalization is determined by multiplying the number of its shares outstanding by its stock price. According to its most recent Securities and Exchange Commission filings, Microsoft has 7,676,218,736 shares outstanding, while Apple counted 4,745,398,000 shares.

While the title of most valuable company can be measured literally, it is also highly symbolic. And the decline of Apple’s position from its lofty perch is a symbol of how investors’ view of its prospects has changed over the past month.

On Nov. 1, Apple’s share price closed at $222.22, which left the company with a market cap of $1.05 trillion. That afternoon, Apple reported quarterly results that included weak growth in iPhone revenue, gave a sales forecast that disappointed Wall Street, and also said that it would no longer report quarterly unit sales of iPhones, iPads and Mac computers. All that led to concerns that Apple’s bellwether products were losing popularity with consumers, and by the time trading wrapped up Friday, Apple’s shares had fallen 19.6 percent for the month.

Microsoft, however, saw its shares rise nearly 4 percent in November. The gain might not have been much, but its mild advance looks like straight-up muscle flexing when compared to Apple’s weakness over the past 30 days.

Microsoft’s performance has been helped by its steady transition to the cloud, and build up a solid position against cloud-services leader Amazon under Chief Executive Satya Nadella, who made cloud technologies Microsoft’s prime focus when he became CEO in 2014.

“While AWS (Amazon Web Services) remains the leader in cloud, we believe Microsoft is starting to close the gap,” said Dan Ives, managing director for research with Wedbush Securities. “More investors are starting to appreciate how leveraged (Microsoft) is to the transformational cloud trend set to play out over the coming years in this cloud arms race.”

Should Microsoft hold onto its position against Apple until the end of December, it will be the first time since 2002 that it will have finished a year as the most valuable company. Apple has held that title every year since the end of 2012.