Tencent (TCEHY -2.96%) and Alibaba (BABA -4.76%), two of the largest tech companies in China, both recently posted quarterly earnings reports that beat analysts' expectations. Tencent's revenue and adjusted earnings rose 29% and 28%, respectively. Alibaba's revenue rose 34% annually as its adjusted earnings grew 18%.

Those impressive growth rates haven't gone unnoticed: Tencent's stock has rallied more than 50% over the past 12 months, while Alibaba's stock has risen over 40%. So is either stock still worth buying near its all-time high?

Stock prices displayed in a window.

Image source: Getty Images.

How does Tencent make money?

Tencent generates its revenue from four main businesses: online games, social networks, digital ads, and its fintech and business services unit.

The online games unit, which generated 34% of its revenue last quarter, houses the world's largest video game publishing business. Its top games include Honor of Kings, Peacekeeper Elite, and PUBG Mobile.

The social networks unit -- which includes China's top messaging platform Weixin (known as WeChat overseas), its social network QQ, the video game streaming platform Huya (HUYA -5.77%), and other media services -- generated 23% of Tencent's revenue from value-added services. Weixin and WeChat's combined monthly active users grew 6% annually to 1.21 billion.

Tencent's online advertising segment, which generated 16% of its revenue, sells ads across Weixin/WeChat, QQ, its media platforms, and its mobile advertising network. The fintech and business services segment, which generated 26% of its revenue, houses WeChat Pay, one of the two largest payment platforms in China alongside Alibaba-backed Alipay; and Tencent Cloud, which ranks second in China's cloud infrastructure market after Alibaba Cloud.

How does Alibaba make money?

Alibaba generates its revenue from four core businesses: its core commerce segment, Alibaba Cloud, digital media and entertainment, and innovation initiatives.

Tiny parcels on a laptop keyboard.

Image source: Getty Images.

Alibaba's core commerce unit, which generated 87% of its revenue and all of its profits last quarter, houses its Chinese e-commerce marketplaces Taobao and Tmall; its cross-border marketplaces (AliExpress, Tmall Global, and Kaola); its business-to-business marketplace Alibaba.com; its Southeast Asian marketplace Lazada; and its Hema supermarkets. The total number of annual active consumers across its Chinese marketplaces rose 2% to 742 million during the quarter.

Alibaba Cloud, which generated 8% of its revenue, is the largest cloud platform in Asia. Its digital media and entertainment unit -- which houses its streaming music and video services, its mobile apps, and its movie production unit -- generated 4% of its revenue. The innovation initiatives segment, which produces side projects like smart speakers and experimental apps, generated the remaining 1% of its revenue.

Which company is growing faster?

Tencent generated double-digit revenue growth across all four of its segments last quarter, led by a 40% jump in gaming revenue.

Its fintech and business revenue rose 29% as WeChat Pay, its related wealth management services, and Tencent Cloud all locked in more users. Its social networking revenue also grew 29% as it reaped the benefits of its takeover of Huya in April, Tencent Music's growth in subscriptions, and robust sales of virtual items in its social network-based games.

Tencent's growth notably accelerated across all its businesses except for online advertising, which still generated 13% growth as older platforms like Baidu struggled to attract advertisers. Tencent didn't offer any guidance, but analysts expect its revenue to rise 29% with 31% earnings growth for the full year.

Alibaba's core commerce revenue rose 34% annually last quarter, as it benefited from a "strong recovery" in e-commerce sales after the COVID-19 crisis, and its cloud revenue rose 59% as it secured more public and hybrid cloud customers. The growth of both businesses accelerated from the previous quarter.

The digital media entertainment unit's revenue rose 9%, compared to 5% growth in the previous quarter, but it included the mobile gaming business, which was previously included in its innovation initiatives segment. That shift reduced its innovation initiatives revenue by 6%.

Alibaba reiterated its prior guidance for at least 28% revenue growth for the full year, while analysts expect its revenue to grow 32%, with 16% earnings growth.

The valuations and potential challenges

Tencent and Alibaba trade at nearly 40 and 30 times forward earnings, respectively. Neither valuation is cheap, but investors seem willing to pay a premium for their growing businesses and wide moats.

But both companies also face regulatory headwinds. Tencent and Alibaba are both exposed to a new U.S. Senate bill that could force Chinese companies to delist their U.S.-listed stocks if they don't comply with new regulations.

Tencent's WeChat could also be banned in the U.S. due to national security concerns, and Alibaba's Taobao remains on the U.S. Trade Representative's blacklist of "notorious" counterfeit marketplaces. However, only a small percentage of WeChat's users are in the U.S., and the trade blacklist hasn't meaningfully affected Alibaba's e-commerce business yet.

The winner: Tencent

Tencent and Alibaba are still both solid long-term investments on China's growth. However, Tencent's better-diversified business, higher operating margins (34% vs. 23% in their latest quarters), and stronger earnings growth make it a better overall investment -- even though it trades at a higher multiple than Alibaba.