Facebook (META 0.14%) and Amazon.com (AMZN 1.49%) are two of the most successful tech companies on planet Earth. So it should come as no surprise that their shares have handily outperformed the market averages over the past one, three, and five years.

Here's a look at how the two have traded since Facebook's 2012 public debut; Amazon recently celebrated the 20th anniversary of its own IPO.

FB Chart

FB data by YCharts

The two companies are in many regards still in the early days of seizing their long-term business opportunities. So let's examine Facebook and Amazon through a three-part lens to gauge which company's shares appear more attractive today.

Financial fortitude

Money isn't an issue for these two companies. Just take a look at these four important metrics of liquidity and solvency to see what I mean:

Company

Cash and Investments

Debt

Cash From Operations

Current Ratio

Amazon.com

$21.5 billion

$7.7 billion

$16.8 billion

1.1

Facebook

$32.3 billion

$0.0 billion

$17.7 billion

12.6

Data sources: All figures for 2016. Yahoo! Finance, Facebook and Amazon investor relations.

Facebook's net-cash balance -- defined as cash and investments minus debt -- sits roughly $18 billion above that of Amazon, giving it an edge in this part of our analysis. Moreover, though both companies produce plenty of cash, Facebook has generated almost $1 billion more in cash from its operations than Amazon has. Finally, Facebook's near-term liquidity, as captured by the current ratio, easily beats that of Amazon.

Facebook earns a clean sweep over Amazon here.

Winner: Facebook.

Durable competitive advantage

As the most powerful companies in their industries, Facebook and Amazon enjoy substantial competitive advantages.

No other company comes close to Facebook's dominance in the social-media landscape. As of its most recent earnings release, Facebook counted 1.9 billion monthly active users (MAUs) and 1.2 billion daily active users (DAUs) on its core social-media platform.  Moreover, Facebook's Instagram subsidiary recently said it surpassed 700 million MAUs in late April. And its Messenger  and WhatsApp messaging apps cater to audiences of 1.2 billion MAUs each.

Facebook's only two real rivals in this space are Twitter and Snap, and neither company breaks out its user numbers as transparently as Facebook. However, we know that as of their most recent earnings releases, Twitter enjoyed 328 million MAUs  and Snapchat counted 166 million DAUs.  That means they're much smaller than Facebook.

Moreover, Facebook's industry clout is perhaps best exemplified in its recent offensive against Snap. In recent months, Facebook added Snapchat-esque features across four parts of its social-media empire, a copycat tactic that appears to be working. Instagram Stories alone have reportedly grown to surpass Snap's DAUs,  which made many wonder whether this move led to Snap's earnings miss  in its first report as a public company.

Like Facebook in social media, Amazon towers over all others in e-commerce. In fact, an analysis from Slice Analytics claimed that Amazon alone garnered 43% of all U.S. e-commerce sales in 2016. The company surpassed $100 billion in revenue in 2015, and it continues to grow like a weed, powered by continued long-term expansions in e-commerce and cloud computing.

One of Amazon's Prime Air airplanes sits in a hangar

Image source: Amazon.com.

Better still, Amazon continues to emphasize innovating in each of these spaces to capture additional market share. For example, it's quietly laying the foundation to vertically integrate its e-commerce operations by also moving into providing logistics and fulfillment services to third parties. This move should provide several benefits to Amazon, such as giving it greater control of its own fulfillment, allowing it to negotiate better terms with other last-mile suppliers such as UPS and FedEx, and letting it continue to offer lower prices in its core e-commerce business.

Amazon is one of the most innovative companies of its generation, and it is in many respects still just getting started.

Winner: Tie.

Valuation

Facebook and Amazon have always been expensive stocks, and that should come as no surprise, given their growth rates and long-term potential. However, Facebook beats Amazon soundly in each of these three popular valuation metrics:

Company

P/E

Forward P/E

P / Cash Flow

Amazon.com

189.5

89.1

42.4

Facebook

39.0

25.6

31.2

Data sources: Yahoo! Finance, Reuters. 

While Facebook is the clear winner here, one point deserves noting: Amazon has historically kept its profitability to as close to zero as investors will tolerate. This approach allows the company to continue to capture market share by offering low prices in its retail business, which leads to a virtuous cycle internally referred to as the Flywheel Effect. However, Amazon's cash flows tend to consistently outstrip its meager profits,  which we see in its price-to-cash flow metric. It's not enough to tilt this section of our analysis in Amazon's favor, but it's an important distinction to draw.

Winner: Facebook.

And the winner is... Facebook by a nose

This decision was tough. I remain extremely bullish on both companies. We're talking about two of the best companies in all of tech, after all. So while Facebook earns the victory, long-term tech investors can't go wrong with adding either stock to their portfolios today.