Apple (NASDAQ:AAPL) may get a lot of the hype in the megatech company circles these days because it makes the highly visible iPhone, but Microsoft (NASDAQ:MSFT) has actually outperformed its rival from an investment perspective over the last one-, three-, and five-year time frames. When it comes to where your investment dollars should go in the future, this is a real rivalry.

While Apple and Microsoft may have a lot in common as tech giants, they still have a lot of differences operationally, and that is what should drive your investment decision.

Kids using tablets in a classroom.

Image source: Getty Images.

A baseline comparison

First, I think it's important to get a baseline of where the two companies are operationally and from a valuation perspective. Below is a comparison of the two companies' revenue, net income, and P/E ratios. Both have grown revenue at similar rates over the past five years, but Apple is significantly larger overall. What's interesting here is that Microsoft has a higher P/E ratio, and that has a lot to do with how investors see the company's future, which I'll get to below.

AAPL Revenue (TTM) Chart

AAPL Revenue (TTM) data by YCharts.

With this baseline established, let's look at their underlying businesses.

Apple's core and growth questions

No company has built as profitable a business as Apple, and the iPhone is at the center of the core product lineup. It took the world by storm more than a decade ago, and no competitor has come remotely close to matching its success or the ecosystem of products and apps that Apple has built around the iPhone. But the iPhone is aging, and it's not clear what's next for Apple.

You can see in the chart above that revenue has grown recently, but that's really due to the rising price of the iPhone, not growing volumes. iPhone sales peaked at 231.2 million units in 2015, according to Statista, and were 217.7 million units last year. That's an incredible core business, but a company doesn't typically grow long term with pricing alone, and that's a big reason the market isn't giving Apple a very high P/E multiple. It's skeptical of growth.

There are interesting products in the lineup like AirPods, the Apple Watch, and Apple TV that may drive incremental growth, but the company doesn't seem to have another iPhone-type product waiting in the wings. Apple's product lineup is one of the most successful of all time, but we have no idea if there's an encore, and that's a big reason the stock isn't trading for a premium today.

Microsoft's new path

We do know what Microsoft's future growth product will be, and that's the Microsoft Azure cloud service and other related cloud products. The cloud offering allows companies to build software and apps using Microsoft's data centers. Last quarter, Azure revenue jumped 76%, and its cloud revenue overall is now larger than Amazon's AWS.

CEO Satya Nadella has done a masterful job transitioning Microsoft from a Windows-centric company to one that now offers most of its services through the cloud. The Office suite of products is now on the cloud and a subscription service that's part of a valuable suite of products for business, including email, word processing, and cloud storage. Whether you're starting an internet-based business or running a legacy noninternet business that needs simple functionality, Microsoft is a key technology service provider.

A decade ago, Microsoft was in the position Apple is in today with questions about growth and what product comes next in its evolution, but those questions have now been answered. In some sense, it's further into this growth phase of its business cycle than Apple. And that's why it has gotten a higher P/E multiple from the market.

The better buy today

Both Apple and Microsoft are great stocks for any investor, but today I think Microsoft is the better bet with its cloud offerings and clear path to long-term growth. Apple may find its next platform for growth, but right now, it appears to be living on the success of the iPhone, and that eventually will erode.

The downside is that Microsoft's stock is more expensive on a price-to-earnings basis. But I think the price is worth paying for the strong position the company has in providing global business software services that thousands of companies rely on every day.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.