Alibaba (NYSE:BABA) and Facebook (NASDAQ:FB) are two of the most influential tech companies in the world. Alibaba owns China's largest e-commerce marketplaces and Asia's largest cloud platform, while Facebook owns the world's largest social network.

Both companies' ecosystems extend far beyond their core businesses. Alibaba owns streaming media services, a movie studio, a video game business, a hardware division, the supermarket chain SunArt, and big stakes in the logistics platform Cainiao, the fintech giant Ant Group, and other companies. Facebook's "family" of apps also includes Messenger, WhatsApp, and Instagram, while its Oculus division sells virtual reality (VR) devices.

Both stocks remained resilient throughout the COVID-19 crisis. Alibaba's stock rallied more than 80% over the past 12 months, while Facebook's stock advanced about 40%. Let's see how the two tech giants withstood those fierce macro headwinds, and which stock is the better investment.

A network of social connections.

Image source: Getty Images.

The similarities between Alibaba and Facebook

Alibaba and Facebook might initially seem different, but both companies generate most of their revenue and profits from advertising, then use that cash to expand their ecosystems.

Alibaba's core marketplaces, including Taobao and Tmall, charge listing fees, which make it the largest online advertising platform in China. Last quarter, Alibaba generated 87% of its revenue from its "core commerce" business, which bundles its listing fees with its direct sales and cross-border marketplaces, brick-and-mortar stores, Cainiao logistics, and other smaller businesses.

Alibaba's core commerce business is its only profitable segment, and its higher-margin revenue subsidizes the growth of its unprofitable cloud, digital media and entertainment, and innovation initiatives segments.

Facebook generated 98% of its revenue from online ads last quarter. Those ads are either displayed within its own ecosystem of apps or across third-party apps and websites via its Audience Network. The rest of Facebook's revenue came from its "other" segment, which mainly sells its Oculus VR headsets and Portal devices.

Facebook subsidizes the production of those low-margin devices, which expand its ecosystem beyond its core social platforms, with its high-margin ad revenue.

Alibaba's massive marketplaces keep growing

Alibaba's health is gauged by the growth of its Chinese retail marketplaces, which generate most of its core commerce revenue. At the end of June, Alibaba's Chinese retail marketplaces hosted 874 million mobile monthly active users (MAUs) -- up 16% from a year earlier.

Packages in a warehouse.

Image source: Getty Images.

It mainly attributed that growth to its expansion into China's lower-tier cities with Taobao Deals, which hit 40 million MAUs last quarter. Tmall's online physical goods GMV (gross merchandise volume) also rose 27% year-over-year, as "all major categories" grew at "similar or faster rates" compared to pre-pandemic levels.

As a result, Alibaba's total revenue rose 34% year-over-year during the first quarter, with 44% growth in core commerce revenue, 66% growth in cloud computing revenue, 6% growth in digital media and entertainment revenue, and 21% growth in innovation initiatives revenue. Its adjusted EPS grew 18%.

China largely contained the pandemic in the first half of 2020, so Alibaba's growth should remain stable over the next few quarters. Alibaba expects its revenue to rise about 28% to 650 billion yuan ($127 billion) in fiscal 2021, which ends next March, and analysts expect its revenue and earnings to rise 38% and 25%, respectively, for the full year.

Facebook's ad growth decelerates

Facebook's ad revenue rose 10% year-over-year last quarter, but that marked a significant slowdown from its previous quarters as companies cut their ad spending throughout the pandemic. Its "other" revenue soared 40% -- thanks to higher sales of Oculus headsets -- but that growth barely lifted Facebook's total sales, which rose 11%.

However, Facebook's EPS grew 98% as it reduced its spending, temporarily paused the expansion of its data centers, and repurchased more shares during the pandemic. It also benefited from an easy comparison to the prior-year quarter, when its earnings were weighed down by big investments and legal expenses.

Facebook's MAUs grew 12% year-over-year to 2.7 billion during the quarter, while MAUs for its entire family of apps rose 14% to 3.14 billion. Its core platform continued to gain users across all four of its global regions -- the U.S. & Canada, Europe, Asia-Pacific, and Rest of World -- which indicates privacy, security, and misinformation concerns aren't curbing its overall growth.

Its worldwide average revenue per user (ARPU) stayed flat year-over-year, as declines in the Asia-Pacific and Rest of World regions offset its growth in the U.S. & Canada and Europe. Analysts expect Facebook's revenue and earnings to increase by 14% and 25%, respectively, for the full year.

Reasonable valuations, unpredictable headwinds

Both stocks are reasonably valued relative to their growth rates: Alibaba trades at just over 30 times forward earnings, while Facebook has a forward P/E ratio of 25.

But both companies also face unpredictable headwinds: Alibaba faces tighter auditing demands in the U.S. and intense competition from domestic rivals like JD.com, while Facebook faces antitrust headaches in Europe and the U.S. and competition from Gen Z-oriented platforms like Snap's Snapchat and ByteDance's TikTok.

Yet I believe both companies will overcome those near-term challenges with the sheer scale of their businesses. Both stocks are still solid long-term investments, but Alibaba's stronger growth and its focus on China instead of other pandemic-stricken regions make it a slightly better buy than Facebook.