Shares of Chinese tech giant Tencent (TCEHY 7.40%) rallied on Wednesday, up 6.8% as of 3:47 p.m. ET.

Tencent, which is arguably the best company in China, reported second-quarter earnings that apparently impressed investors. It's easy to see why; revenue growth accelerated relative to the prior quarter and year, along with continued margin expansion.

Unsurprisingly, artificial intelligence leadership was mentioned as a key factor behind the top-line growth and cost controls.

Tencent grows double-digits almost everywhere

Tencent's revenue is on a $100 billion run-rate, so it's really impressive that the company was able to accelerate its revenue growth in light of the law of large numbers. Total revenue grew 15% year over year, a higher rate than the 13% rate last quarter and the 8% growth rate in the year-ago quarter.

Every major segment for Tencent grew double-digits, reflecting broad-based strength, except for Social Networks, which saw just 6% growth due to a lack of compelling new content in video streaming. Still, the other major segments including Domestic Games and International Games grew 17% and 35%, respectively. Marketing revenue was up 20%, and FinTech and Business Services revenue was up 10%.

Impressively, margins also expanded with gross margins expanding by 1.1 percentage points relative to last quarter. While adjusted (non-IFS) operating margins fell quarter over quarter, that appears to be a seasonal trend possibly around compensation. Relative to the prior year, adjusted operating margins expanded by 1.2 percentage points to a strong 37.5%.

The acceleration shows the Chinese economy, which had been in near-recessionary conditions for a couple years, may finally be recovering on the back of last year's stimulus measures.

But some of the acceleration could also be due to AI. Management touted the use of AI across all its business segments, including game and content production, online advertising effectiveness, and Tencent's cloud business.

Hands on a phone with letters AI on it.

Image source: Getty Images.

Tencent is a core holding for a Chinese portfolio

For those willing to invest in China, Tencent should be at the top of the list. The company is diversified across not one but several high-margin businesses, and allocates profits effectively across dividends, buybacks, and investments in other companies.

With net cash on its balance sheet and over $100 billion worth of outside investments -- roughly 15% of its market cap -- Tencent's 27 P/E ratio is hardly demanding, even after this nice recent run.