SAN FRANCISCO (Reuters) - Microsoft Corp's MSFT.O stock market value surpassed Apple Inc's AAPL.O, pulling ahead by as much as $3 billion on Wednesday as the Windows software maker benefited from optimism about demand for cloud computing services.

Slideshow ( 2 images )

Shares of Microsoft jumped 3 percent, pushing its market capitalization up to $848 billion. With the broad market rebounding from a recent slump, Apple also rose, but less than Microsoft. Its 2.17 percent increase put Apple’s market capitalization at $845 billion, just four months after the iPhone maker breached the $1 trillion mark for the first time.

Microsoft and Apple briefly traded at about the same level after the bell on Monday, but Microsoft’s intraday lead over Apple on Wednesday was more substantial.

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

(Graphic: Microsoft chases Apple - tmsnrt.rs/2Rq2U0J)

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

Since then, Microsoft has not ended an official trading session with a stock market value greater than Apple’s.

(Graphic: Blue chip market caps for past 20 years - tmsnrt.rs/2RkOtLf)

Shares of several cloud software makers also rose on Wednesday after Salesforce.com Inc's CRM.N upbeat quarterly earnings boosted Wall Street expectations for the fast-growing sector, which faced pressure in the recent sell-off in technology stocks.

Since Satya Nadella took over as chief executive in 2014, Microsoft has 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 as investors worried about rising interest rates and fallout from the U.S.-China trade war.

But Apple has suffered more than other Silicon Valley stalwarts, losing 19 percent since the iPhone maker warned on Nov. 1 that crucial holiday-quarter sales would likely miss Wall Street expectations.

Global demand for smartphones has slowed in recent years, making it more difficult for Apple to increase its revenue.

Thirty-three analysts recommend buying Microsoft’s stock, while just one has a negative rating and another has a neutral rating, according to Refinitiv data.

Twenty-six analysts have positive ratings on Apple, another 16 are neutral, and none recommend selling its stock.

For fiscal 2019, analysts on average expect Microsoft’s revenue to increase 11 percent, compared with an estimated 5 percent for Apple, with iPhone sales growing less than 1 percent, according to Refinitiv data.