Image source: Microsoft.

Most consumers and industry observers would probably agree that Apple (AAPL 0.52%) has been a more successful business than Microsoft (MSFT -2.45%) in the last few years. After all, Apple has been at the forefront of the mobile computing revolution, while Microsoft has lagged the competition in this important area.

However, things are surprisingly different when looking at stock price performance over the middle term: Microsoft stock has gained nearly 98% since January of 2013, versus a much more modest gain in the neighborhood of 40% for Apple over the same period. 

AAPL Chart

AAPL data by YCharts.

Let's take a look at the main reason Microsoft stock is materially outperforming Apple and, much more importantly, what the future may hold for investors in the two companies over the coming years.

Valuations matter
Microsoft has nearly doubled Apple in terms of stock market returns since 2013, but this outperformance can hardly be justified with revenue or earnings growth. Far from that, Apple has done much better than Microsoft on both fronts: Apple has increased sales by 39% and earnings by 57% in the period under analysis, while Microsoft produced a much more modest increase of 16% in sales and declining earnings per share over the period.

Interestingly enough, successful investing is about much more than picking the companies with the best financial performance. Sales and earnings are remarkably important, but you also need to consider stock prices and what kind of expectations are incorporated into valuations at a specific point in time. When expectations are too low and valuation levels represent an opportunity, a stock can deliver superior returns for shareholders even if financial performance remains subpar.

Back in 2013, Microsoft was a stagnant company, its Windows business was under heavy pressure because of the mobile computing revolution, and the company had missed many of the most important industry trends over the previous decade. Because of lousy growth expectations, Microsoft stock was priced at a remarkably low price to earnings ratio -- in the single digits.

Satya Nadella was appointed as Microsoft CEO in February of 2014, and the company has made a lot of progress since then. Windows 10 is outpacing adoption of any of the company's previous operating systems, and management believes the business is on track to reaching over one billion active Windows 10 devices in the coming years. Microsoft is also doing a sound job at adapting Office to the cloud computing paradigm: Office 365 commercial revenue grew nearly 70% in constant currency last quarter.

Expectations have clearly improved for Microsoft over the last couple of years, and this has been reflected on a rising valuation for the stock. Forward-price to earnings has nearly doubled since 2013, which has been a major return driver for investors in the company.

AAPL PE Ratio (Forward) Chart

AAPL P/E Ratio (Forward) data by YCharts.

Apple is a very different story. Growth in the smartphone industry is slowing down, and Apple depends on the iPhone for nearly 70% of its sales. Since future growth prospects are unclear at this stage, valuation has remained stagnant, or even declined since 2013, so Apple stock has not performed as well as the company's sales and earnings over this time frame.

Moving forward
The key point is that valuation can play a major role as a return driver for investors, and that's one of the main reasons Microsoft stock has produced bigger gains than Apple over the last few years. On the other hand, the future looks remarkably different for the two companies at current prices since Apple stock is trading at a much cheaper valuation.

You can't just make an investment decision based on valuation metrics alone; business quality and growth prospects are remarkably important variables to consider. Nevertheless, it's much easier to beat expectations when those expectations are low, and judging by current valuation metrics, expectations are quite modest when it comes to Apple nowadays.