Image copyright Reuters Image caption Bill Gates founded Microsoft. The firm's fortunes have rebounded in recent years

Microsoft has unseated Apple to rank as the world's most valuable listed company, reclaiming the number one spot after more than 15 years.

The software giant ended Friday with a market value of more than $851bn (£668bn) compared with Apple's $847bn.

The two firms have been vying for top place all week, with Apple remaining ahead at the end of each trading day.

But the iPhone maker, which has seen its share price plunge in recent weeks, finally lost its lead.

On Friday, Microsoft shares gained more than 0.6% to close at $110.89, while Apple shares finished at $178.60, down about 0.5%.

Apple's shares have fallen almost 25% since October - more steeply than the market overall - amid concerns about slowing smart phone demand and the possibility of additional US tariffs on Chinese-made goods.

The sell-off has erased more than $200bn from the firm's market value, which is calculated by multiplying the share price by the number of traded shares cited in the firms' most recent quarterly reports.

By many measures - including annual revenue and profit - Apple remains the bigger company.

For now, however, investors are betting that Microsoft's prospects are brighter.

The firm's cloud services unit, which sells to other businesses, has driven the firm's growth in recent years.

Apple, by contrast, depends on consumer spending, which investors are worried could slow.

Daniel Ives, managing director of equity research at Wedbush Securities, said Microsoft is poised for significant growth, as more companies sign up for the firm's cloud products.

Microsoft boss Satya Nadella is well-positioned to "further transform [Microsoft] into a cloud behemoth over the coming years," he wrote in a research note.

Image copyright Getty Images Image caption Microsoft chief executive Satya Nadella has focused on cloud services

Microsoft flourished in the 1990s and ranked as the world's most valuable company in the early 2000s.

But the firm took a hit after a landmark anti-trust case and fell farther out of favour as mobile phones emerged to challenge desktop computers.

In 2010, Apple overtook Microsoft as the most valuable technology firm.

The iPhone maker unseated Exxon Mobil for the overall number one spot for the first time in 2011, and has held the title largely uninterrupted since.

It became the first trillion dollar company in the US this summer, but lost that distinction this autumn as its share price started to plunge.