Image source: Getty Images.

Today's battle features not only two of the biggest companies in the world but neighbors that practically live in each other's Seattle-area backyard. Microsoft (MSFT 0.37%) and Amazon.com (AMZN -1.64%) have combined to produce an enormous wave of innovation over the last 25 years. That's had profound effects on just about everyone, including shareholders.

Microsoft stock has returned 53,000% since going public in 1986, and Amazon stock has generated 39,000% growth since its debut in 1997. Those are compounded growth rates of 23% and 37% per year, respectively. While I think it's prudent to assume that type of growth might not be the norm moving forward, both companies remain compelling buys.

But which is better? Below, I'll try to evaluate them based on three key criteria.

Financial fortitude

While cash in the bank isn't very sexy for shareholders, it's enormously important over the long run. The reason for that, quite simply, is that in life, (stuff) happens. Whether it be a majorly botched product, competition disrupting an industry, or a severe economic downturn, you can be rest assured that both companies will confront some type of chaos in the decades to come.

Cash in the bank is a key survival tool. It allows management to continue pursuing its core vision, without having to cut corners, or lower expectations just to make ends meet. Companies that are in deep debt are in the opposite situation -- forced to do whatever possible to survive.

Here's how Microsoft and Amazon stack up on this front.

Company

Cash

Debt

Net Income

Free Cash Flow

Amazon

$18.4 billion

$19 billion

$2.1 billion

$8.6 billion

Microsoft

$137 billion

$76 billion

$16.6 billion

$26.8 billion

Data source: Yahoo! Finance. Net income and free cash flow are presented on trailing-12-month basis.

Let's start out by stating the obvious: Both of these companies are in very good shape with regards to financial fortitude. But if forced to choose, I would have to side with Microsoft. The company has a much deeper cash stash -- even relative to its debt -- than Amazon, and produces enormous free cash flows.

Winner = Microsoft

Sustainable competitive advantages

When it comes to the success of my own personal investments, none has been more predictive of their success than the sustainable competitive advantages of the underlying companies. In investing circles, this is normally called a moat. And a moat is so important because it becomes the key durable differentiator between a company and its competitors.

Amazon has a two-fold competitive advantage. The first is its massive network of fulfillment centers. Each multimillion-dollar center helps the company to provide the best customer service possible -- as evidenced by the speed at which your order arrives at the front doorstep.

Currently, it is estimated that Amazon has 85 such centers in the U.S., with plans for 20 more. Worldwide, there are 117 such centers, with plans for that total to reach at least 129. Any company wanting to challenge Amazon on customer service would have to endure years of infrastructure build-out and unprofitability to even come close to Amazon's reach.

Furthermore, Amazon's Prime membership has become a huge boon. With free two-day delivery -- and a growing list of other benefits -- this has become Amazon's primary hook for new customers. Unable to find a similar deal elsewhere, I believe that Prime users have high switching costs when it comes to delivery.

Microsoft, on the other hand, relies on its established line of software products -- namely Office Suite. While some may mock how long it's been around, it undeniably has staying power. More and more computer users are trained on Word, Excel, and Powerpoint than any other similar programs. While competitors -- namely Alphabet through its Google Docs offering -- may provide similar products, people are loathe to learn a new system when the one they're using works just fine.

Additionally, through its various other offerings -- Bing, Outlook, and, soon, LinkedIn -- Microsoft is building an ecosystem that will make it easier to keep and store vital information.

In the end, both companies have very strong moats, but I would give the nod to Amazon, based on the fact that there's a physical aspect to it (the fulfillment centers) that would be difficult to disrupt without massive spending.

Winner = Amazon

Valuation

Finally, we have valuation. While there are many ways to measure this, I actually think this is a pretty easy one to call.

Company

P/E

P/FCF

P/S

PEG Ratio

Amazon

177

43

2.9

3.8

Microsoft

21

11

1.7

1.4

Data source: Yahoo! Finance, E*Trade. P/E represents figures from non-GAAP earnings.

Amazon CEO Jeff Bezos is famous for playing the super-long game, which means reinvesting sales into the business at a breakneck pace. That helps explain the chasm in valuation between these two companies. While it's almost impossible to fairly value Amazon, I'm comfortable saying that Microsoft has a more favorable valuation.

Winner = Microsoft

So there you, it's essentially a tie. Which is fitting since these are both such successful companies. If forced to choose, I'll go with where I have my skin in the game: Amazon. The company has grown to become over 15% of my family's real-life holdings. But I really think you can't go wrong with either one of these two stocks.