Alibaba (BABA 1.14%) and Alphabet (GOOG -3.33%) (GOOGL -3.37%), the parent company of Google, are two of the largest tech companies in the world. Alibaba is the largest e-commerce and cloud platform company in China, while Google owns the world's top online search engine, streaming video platform (YouTube), and mobile OS (Android). It also owns the world's third-largest cloud infrastructure platform.

Investors might look at those growth engines and assume Alibaba and Alphabet are both great long-term investments. But over the past five years, Alibaba's stock was cut in half as Alphabet's stock more than doubled. Let's see why Alibaba floundered as Alphabet flourished -- and if that trend is likely to continue for the foreseeable future.

A couple cheers while looking at a laptop computer.

Image source: Getty Images.

Why did investors give up on Alibaba?

Three headwinds crushed Alibaba over the past few years. First, China's antitrust regulators hit the company with a record $2.8 billion fine in 2021. It was also forced to end its exclusive deals with merchants, halt its aggressive loss-leading promotions, and seek government approvals for future investments and acquisitions. Those restrictions eroded its defenses against its main rivals, JD.com and Pinduoduo, in China's cutthroat e-commerce market.

Second, China's economic growth stalled out and curbed consumer spending on its e-commerce platforms as well as enterprise spending on its cloud services. Lastly, China's intermittent "zero COVID" lockdowns throughout 2022 exacerbated that slowdown and caused Alibaba's growth to slow to a crawl.

Nevertheless, Alibaba's revenue and adjusted earnings per American depositary share (ADS) still rose 2% and 4%, respectively, in fiscal 2023 (which ended on March 31). It also split its business into six new groups (Cloud Intelligence, Taobao Tmall Commerce, Local Services, Cainiao Smart Logistics, Global Digital Commerce, and Digital Media and Entertainment) earlier this year and plans to spin off the cloud group through an IPO. It's also exploring potential IPOs for Cainiao and its Global Digital Commerce group.

Those spin-offs could free each group to pursue fresh funding and expand on their own without fretting over how they might affect Alibaba's other businesses. Those smaller groups probably also won't attract as much attention from China's antitrust regulators. For fiscal 2024, analysts expect Alibaba's revenue and adjusted earnings per ADS to grow 9% and 10%, respectively, as China finally experiences its long-awaited late-stage COVID recovery.

Alibaba's core businesses might warm up again as that macro environment improves, but the tensions between the U.S. and China still represent a long-term problem: It still faces delisting threats in the U.S. and could be barred from buying the latest chips for its cloud servers. That's probably why Alibaba still trades at just 9 times forward earnings.

Why were investors more bullish on Alphabet?

Alphabet generates most of its revenue from Google's advertising business. That core business suffered a slowdown in 2020 as the pandemic caused companies to buy fewer ads, but Alphabet partly offset that pressure by expanding Google Cloud -- which grew at a faster clip as the usage of cloud-based services skyrocketed throughout the crisis.

The growth of Google's advertising business accelerated again in 2021, but rising interest rates and other macro headwinds cut that recovery short in 2022. Once again, Alphabet offset Google's softer ads sales with the expansion of its cloud business -- but its revenue only rose 10% last year as its earnings per share (EPS) declined 19%.

As Alphabet's growth cooled off, its weaknesses became more glaring. OpenAI's ChatGPT, which is backed by Microsoft and integrated into its Bing search engine, could challenge Google's core search engine. Google is fighting back with its own Bard chatbot, but that seems like a reactive move instead of a proactive one. Google also pays Samsung and Apple billions of dollars annually to remain the default search engine on their mobile devices, but recent reports suggest those two tech giants could still switch to Bing for the right price.

YouTube is still synonymous with online videos, but it faces lots of competition from short video platforms like ByteDance's TikTok and Meta Platforms' Instagram Reels. It's trying to keep pace with that shift with its own YouTube Shorts, but it's too early to tell if that new feature will pull enough younger users away from TikTok and Reels.

On the bright side, Google Cloud turned profitable in the first quarter of 2023 -- which suggests it isn't expanding its cloud ecosystem with margin-crushing tactics -- and its advertising sales should accelerate again in a healthier macro environment. Based on those expectations, analysts expect Alphabet's revenue and earnings to grow 6% and 17%, respectively, for the full year. At 22 times forward earnings, Alphabet seems pricier than Alibaba -- but it's still the cheapest FAANG stock.

The better buy: Alibaba

It's easy to see why Alphabet outperformed Alibaba over the past five years. But today, Alibaba has a clearer path toward a recovery as it spins off some of its lower-margin groups and profits from China's growth in the latter stages of the COVID pandemic. If the tensions between the U.S. and China wane, its stock could easily fetch a higher valuation.

Meanwhile, Alphabet faces a murkier future as it faces tougher competitors, and its stock isn't a screaming bargain yet. So this time around, Alibaba seems like the better buy.