Microsoft's stock market value surpassed Apple's and pulled ahead by as much as $3 billion last night as the Windows software maker benefited from optimism about demand for cloud computing services.

Shares of Microsoft jumped 3%, pushing its market capitalisation up to $848 billion. 

With the broad market rebounding following a recent slump, Apple also rose, but less than Microsoft. 

Its 2.17% increase put Apple's market capitalisation 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 last night was more substantial. 

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

Apple's market capitalisation 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.