Amazon (NASDAQ:AMZN) and Facebook (NASDAQ:FB) have grown to dominate different parts of the technology industry. Amazon has emerged as the leader in e-commerce and cloud computing, while Facebook has taken a commanding lead in social media.

But both derive revenue from online advertising, which makes the two tech stocks competitors despite having significantly different businesses.

This commonality makes for an interesting comparison between the two. Let's take a closer look to see which can potentially drive higher investor returns in the online ad space.

The state of Amazon

Most think of Amazon as an e-commerce company. Although that is an accurate assessment in many respects, it derives most of its profit from its cloud-computing segment, Amazon Web Services (AWS). Also, its move into online ads will likely evolve into a significant revenue segment over time.

This has helped to give the company a market cap of about $1.6 trillion. Consequently, it actively competes with Microsoft for the title of the second-largest company trading on the market today.

Young woman on couch staring at her smartphone while holding a cup of coffee.

Image source: Getty Images.

Yet despite this massive size, Amazon stock is not as expensive as it appears. Yes, its forward P/E ratio of approximately 60 may seem high. Nonetheless, its strengths in e-commerce and cloud computing made it a solid pandemic stock. As a result, it continues to post substantial growth numbers.

In the most recent quarter, net sales rose 37% from year-ago levels. This resulted in net income tripling over the same period. For the upcoming quarter, which includes the holiday season, the company forecasts revenue will increase between 28% and 38%.

Admittedly, some investors may not want to buy a stock that has already risen by about 65% this year. But with the massive growth set to continue, it is hard to bet against the online giant.

AMZN Chart

AMZN data by YCharts.

Where Facebook stands

Facebook is an online ad giant in its own right. Its dominance of social media has allowed the company to compete with Amazon and Alphabet's Google in the lucrative online ad space.

Although its approximately $780 billion market cap is less than half the size of Amazon's, it remains one of the world's largest tech companies. Moreover, like Amazon, it is not as expensive as some might assume.

Its forward P/E ratio stands at only about 25. And although COVID-19 did slow its growth in ad sales for a time, revenue growth remains in the double digits. By the third quarter, the financials had shown significant recovery.

In the third quarter, revenue increased by 22% from year-ago levels. Also, earnings per diluted share surged by 28% over the same period. Moreover, the company predicts fourth-quarter revenue will rise from the previous quarter.

Facebook expects holiday advertising will help drive these increases. It also believes higher sales of the Oculus Quest 2 virtual reality headset will boost revenue. However, Oculus makes up less than 2% of the company's revenue.

Despite the disruption from COVID-19, Facebook stock has risen by about 32% this year. Given its recovery from the pandemic and its continuing ability to drive higher revenue, the stock should continue to march higher.

FB Chart

FB data by YCharts.

Amazon or Facebook?

Both companies are proven successes in high-growth industries. This means investors will likely profit from buying either stock. Still, despite Facebook's lower forward P/E ratio, I have to recommend Amazon in this case.

Admittedly, Amazon investors will have to pay more than double the forward valuation. Still, Amazon is dramatically surpassing its tech counterpart on profit growth.

Moreover, Amazon benefits from a more diverse business. Indeed, it helped that the company's two primary revenue drivers, e-commerce and cloud computing, benefited from the pandemic. It could gain an increased advantage by potentially cutting into Facebook's ad business. 

This is somewhat troubling for Facebook as ads remain its primary revenue driver. While Oculus has shown early signs of success, it will probably remain a tiny percentage of revenue for the foreseeable future. 

For these reasons, Amazon should drive more significant returns in the near term, even when accounting for the higher valuation.

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.