SAN FRANCISCO (Reuters) - Microsoft Corp's MSFT.O stock market value closed above Apple Inc's AAPL.O for the first time in eight years on Friday as the Windows maker benefited from growth in cloud computing while Apple was hit by investor concern about iPhone demand.

Shares of Microsoft rose 0.6 percent to end the week at $110.89, putting its market capitalization at $851.2 billion. Apple shares fell 0.5 percent to $178.58 on the day, adding up to a market value of $847.4 billion.

The two stocks jostled for the top spot over the course of the week, with Microsoft’s stock market value exceeding Apple’s at several points in intra-day trading but not at the close.

Both companies’ market capitalizations were calculated using outstanding shares reported in their most recent 10-Q filings.

Apple’s market capitalization overtook Microsoft’s in 2010 as Microsoft struggled with slow demand for personal computers, due in part to the explosion of smartphones like the iPhone.

After Satya Nadella took over as chief executive in 2014, Microsoft reduced its reliance on Windows software for PCs and became a major player in cloud computing, second only to Amazon.com Inc AMZN.O.

In recent months, technology shares have been punished by investors worried about rising interest rates and the potential consequences of the U.S.-China trade war.

Apple shares are now 19.6 percent lower than on Nov. 1, when the company warned after the regular session that holiday-quarter sales would likely miss Wall Street expectations.

Global demand for smartphones has slowed in recent years.

Thirty-three analysts recommend buying Microsoft’s stock, with just one sell rating and one neutral, according to Refinitiv data.

Twenty-five analysts have positive ratings on Apple, 16 are neutral and none recommend selling, the data show.

Analysts on average expect Microsoft’s revenue to increase 12.7 percent for its fiscal year 2019 ending in June, compared with an estimated 5 percent rise for Apple’s fiscal 2019, which ends in Sept, according to the Refinitiv data.