Baidu (BIDU 1.24%) and Alibaba (BABA 0.09%) are two of China's largest tech companies. Baidu owns the country's largest search engine, and Alibaba owns its top e-commerce marketplaces and cloud platform.

I compared these two stocks back in late January, and declared that Baidu's "accelerating growth, expanding ecosystem, and lower valuation" made it a better buy than Alibaba. But since then, Baidu's stock declined about 4% as Alibaba's stock rallied nearly 30%.

I clearly overestimated Baidu's ability to continue growing and underestimated the resilience of Alibaba's e-commerce and cloud businesses. Let's see what I got wrong, and whether or not Alibaba will continue to outperform Baidu.

A view of China, Korea, Japan, and Taiwan from space.

Image source: Getty Images.

What I got wrong about Baidu

At the beginning of 2020, Baidu's core advertising business faced two main headwinds: the Chinese economy's slowdown, which was exacerbated by China's trade war with the U.S., and competition from rivals like Tencent (TCEHY 1.91%) and ByteDance. It didn't include the COVID-19 pandemic.

China identified the first COVID-19 cases last December, but only started implementing lockdowns in late January. Afterwards, ad spending from afflicted industries -- including travel, auto, and retail -- slowed to a trickle. Meanwhile, online gaming, e-commerce, and online education companies -- which all stood to profit from the lockdowns -- ramped up their ad spending, but mainly focused on higher-growth platforms like Tencent's WeChat and Bilibili instead of Baidu.

As a result, Baidu's online marketing revenue, which accounted for over two-thirds of its top line last quarter, declined year-over-year for five consecutive quarters. Baidu relied on the growth of its video streaming unit iQiyi (IQ 0.72%) to offset those declines, but iQiyi's losses weighed down its margins. To cushion that blow, Baidu reduced its traffic acquisition costs at its main search engine -- but that likely made it even more difficult to revive its ailing advertising business.

What I got wrong about Alibaba

At the beginning of the year, I noted the growth of Alibaba's core commerce business was decelerating, and it was relying on lower-margin businesses -- including brick-and-mortar stores, cross-border marketplaces, and its stake in the logistics company Cainiao -- to buoy the business' growth.

Tiny parcels on a laptop keyboard.

Image source: Getty Images.

That shift worried me, since Alibaba's core commerce business, which generated 87% of its revenue last quarter, is its only profitable unit. Alibaba subsidizes the expansion of its other unprofitable businesses -- including its cloud, digital media and entertainment, and innovative initiatives units -- with its core commerce segment's profits.

The COVID-19 crisis also seemed poised to exacerbate that slowdown, especially after Alibaba's management warned of upcoming disruptions in its conference call in February. But Alibaba's slowdown was short: Its revenue rose 22% year-over-year in the fourth quarter, which bore the full impact of the COVID-19 crisis, but accelerated to 34% growth in the first quarter as its adjusted EPS grew 18%.

Alibaba attributed its quick recovery to robust sales across "all categories" after the pandemic, its e-commerce expansion into lower-tier cities, the growth of its online grocery and food delivery businesses, and accelerating demand for cloud services throughout the crisis. In short, the crisis lit a fire under its core businesses and cancelled out most of the bears' concerns.

Which company has a brighter future?

Baidu faces tough headwinds, but analysts expect its revenue and earnings to rise 2% and 7%, respectively, this year. The expansion of its ecosystem beyond text-based PC and mobile searches with its DuerOS voice assistant, Smart Mini Programs on the Baidu App, its Apollo platform for driverless cars, and other next-gen platforms could support that growth.

However, Baidu still trades at just 12 times forward earnings, which suggests that investors aren't too thrilled about its near-term prospects. The recent SEC probe related to allegations of fraud against iQiyi are also casting a dark cloud over the company.

Alibaba faces fewer headwinds than Baidu, and analysts expect its revenue and earnings to rise 37% and 24%, respectively, this year. Its ongoing push into lower-tier cities will likely pull shoppers away from its smaller rival Pinduoduo, and it could gradually narrow its losses at its cloud division as economies of scale kick in. Alibaba could also reap big profits from the upcoming IPO of its fintech affiliate Ant Group.

Alibaba is more richly valued than Baidu at 30 times forward earnings, but it's still reasonably valued relative to its growth rate.

The winner: Alibaba

Baidu isn't down for the count yet, but it was clearly hit harder by the COVID-19 crisis than Alibaba. Unless Baidu consistently grows its ad revenue again, offers more clarity on iQiyi's challenges, and aggressively monetizes its ecosystem-expanding efforts, Alibaba will remain the better all-around investment.