They're two of the five largest publicly traded companies in the world. They're technology giants that are increasingly competing against one another in multibillion-dollar growth industries such as cloud computing and artificial intelligence. They're Amazon.com (AMZN -3.10%) and Microsoft (MSFT -4.29%).

And they're vastly different companies in terms of their core operational focuses, their recent histories, and their cultures. So which is the better buy today? Let's examine Amazon.com and Microsoft through three analytical lenses, to determine which tech stalwart represents the better stock to buy today.

Financial fortitude

Though both companies are financial behemoths, Microsoft beats Amazon in this comparison of financial fortitude. Here's a quick summary of several important liquidity and solvency measures for each company.

Company   Cash and InvestmentsDebtCash From Operations  Current Ratio
Microsoft $122.7 billion $84.9 billion $36.7 billion 2.1
Amazon.com   $25.9 billion $7.7 billion $16.4 billion 1.0

Data sources: Amazon.com and Microsoft investor relations, Yahoo! Finance. 

Microsoft and Amazon are in fine financial shape. However, even though Microsoft carries more debt than Amazon, it earns a win in this category by beating the world's largest e-commerce provider in three categories. Plus, only $600 million of Microsoft's borrowings will come due this calendar year.  The overwhelming majority of Microsoft's debt comes due after 2020, and then at very low interest rates. Given the company's cash flow generation capabilities, servicing that debt should be no issue for Microsoft.

It also bears noting that Microsoft, like Apple, keeps the bulk of its cash holdings overseas to shield it from repatriation taxes. In its most recent 10-Q, the company didn't disclose how much cash lies offshore, but its annual 10-K filing showed that it kept approximately 96% overseas. But since it generates plenty of operating cash flow to fund its domestic and international operations, this is really a non-issue for investors.

Winner: Microsoft.

Durable competitive advantages

Microsoft and Amazon.com each enjoy competitive advantages, albeit of different sorts. Amazon's primary moats are its scale and risk-taking culture. At this point, Microsoft's competitive insulation seems more structural and historic. Let's unpack each of those a bit more.

Amazon generates the bulk of its sales from its core e-commerce operations, accounting for 91% of revenue in 2016. As the world's largest e-commerce site by revenue, Amazon has an incredible scale that allows it to consistently offer low prices. More impressive still, Amazon's unique ability to turn its own platform into sources of revenue -- think Amazon Web Services, Fulfillment by Amazon, third-party ads on Amazon.com, and so on -- allows it to charge the lowest prices possible on its e-commerce site, which in turn attracts more customers. This self-regenerating business philosophy is best summarized in the idea of the Flywheel Effect, which is at the core of Amazon's strategy and touches on its unique culture.

Amazon's first freight airplane

Image Source: Amazon.com 

To create a culture that could invent profit centers to buoy its low- or even negative-margin e-commerce sales, Amazon CEO Jeff Bezos and his team needed to create a culture where risk-taking and unconventional thinking were the norm. Bezos summarized risk-taking's foundational place in Amazon's culture in the 2015 annual letter:  

A word about corporate cultures: For better or for worse, they are enduring, stable, hard to change. ... One area where I think we are especially distinctive is failure. I believe we are the best place in the world to fail (we have plenty of practice!), and failure and invention are inseparable twins.

Without its unique corporate mindset, Amazon never would have had the audaciousness and vision to launch many of its most important initiatives, making its culture arguably its most important asset and source of enduring competitive advantage.

Microsoft's source of competitive advantage, on the other hand, can be summarized in one word: "Office." It remains Microsoft's financial heart and soul and is the largest revenue source at the company, singlehandedly accounting for $23.5 billion, or 27%, of Microsoft's $85.3 billion in sales in fiscal 2016. 

CEO Satya Nadella's 2015-16 reorganization of Microsoft's operations created three new reporting segments: productivity and business processes (PBP), intelligent cloud, and more personal computing. PBP houses the consumer and commercial Office operations, as well as Microsoft's Dynamics CRM platform. The entire segment generated $26.5 billion of Microsoft's total sales, so we know, using the Office revenue figure, that Office drives the segment's performance.

Its importance comes into greater focus when looking at Microsoft's operating-profit breakdown. PBP -- again, mostly Office -- generated $12.4 billion, or 62%, of Microsoft's $20.1 billion in fiscal 2016 operating income, making it the financial bellwether that guides Microsoft's financial performance.

Other segments, particularly Intelligent Cloud, have become increasingly important pieces of Microsoft's financial footprint as well. However, Microsoft's core competitive advantage still lies in the fact that Word, Excel, and PowerPoint make up the default productivity software for the majority of world's computer-using population, and that's a source of tremendous advantage -- and profit -- for the company.

Winner: Tie.

Valuation

Comparing the valuations of Microsoft and Amazon isn't the simplest exercise, given their different growth profiles. With that in mind, here are three of the most commonly used valuation metrics for each company.

CompanyP/EForward P/E  EV/EBITDA   
Microsoft 30.2 19.7 16.8
Amazon.com     173.7    66.1 34.1

EV = ENTERPRISE VALUE. EBITDA = EARNINGS BEFORE INTEREST, TAXES, DEPRECIATION, AND AMORTIZATION. Data source: Yahoo! Finance. 

Here we get a great comparison of two investing styles -- growth versus value. Neither comes out ahead here. More conservative investors who prefer to own stocks with something of a margin of safety will probably be drawn to Microsoft, with its more conservative valuation and 2.3% dividend yield. Of course, those same investors have always argued that Amazon is overvalued, even as the company's stock ascends ever higher.

From the perspective of a long-term investor, I believe Amazon's ability to grow at above-average rates for years, if not decades to come, will enable it to grow into and beyond its current valuation. Microsoft's main issue, meanwhile, remains its growth outlook.

This analysis is somewhat subjective. More risk-averse investors, particularly those nearing retirement, might want to stay away from Amazon stock. However, for those with the ability to buy and hold a company for a decade or more, I like Amazon despite its aggressive valuation today.

Winner: Tie.

And the winner is... Amazon, by a nose

Both Amazon and Microsoft offer investors attractive investment opportunities, in very different ways. As I mentioned, Microsoft is probably a better option for more risk-averse investors. It's a stable, mature company and should derive the bulk of its financial returns from growing profits and EPS, rather than through rapidly expanding its top line. Amazon's growth trajectory, meanwhile, is generational, as it looks to rewrite the rules of the global retail industry. In the end, Amazon strikes me as the better stock for long-term investors to buy today.