Baidu Inc beats the quarterly profit and revenue estimates of analysts late Wednesday, helped by strong growth on its iQIYI video streaming platform, and sending shares of the Chinese search engine giant up 5 percent.

The company has tried to reduce its reliance on the core search business and expand into other areas such as cloud services and artificial intelligence, but most of its success to date has been with iQIYI Inc. (IQ.O) video streaming service.

Revenue from iQIYI, which competes with Alibaba-backed (BABA.N) Youku and Tencent Holdings' Tencent Video, grew by almost 7 percent to 7.4 billion yuan ($1.06 billion) as the company reached 105.8 million users this year. In extended trading, IQIYI shares have rallied by 4 percent.

The results come as Baidu (BIDU.O) battles a slowing Chinese economy against the backdrop of the country's protracted trade war with the US, tighter advertising regulations, and rising competition from rivals like TikTok.

Last week, Alibaba Group Holding Ltd also outperformed the estimates for income and sales, demonstrating that diversification approaches at some tech giants can help offset macroeconomic pressures.

Diversification has arrived at a cost, though that's something the company has been very wary of. Over the quarter, Baidu's total costs and expenses increased by more than 8.0 percent to 25.73 billion yuan, while content costs rose by 4.5 percent.

Revenue from the online marketing services business of the group, which involves search, news feeds and a video app and is a major contributor to total sales, dropped to 20.43 billion yuan by about 9 percent.

According to IBES information from Refinitiv, Baidu, whose search engine dominates the market in China, predicted fourth-quarter sales between 27.10 billion yuan and 28.70 billion yuan, although analysts are predicting 27.52 billion yuan.

A third-quarter net loss of RMB6.37 billion ($892 million) or a share of $2.57 was announced by the Chinese tech company.

Earnings per ADS were $1.76, adjusted for one-time items. Baidu said its third-quarter losses included a RMB8.9 billion non-cash impairment due to changes in equity investment valuation.

Revenue increased to RMB28.1 billion ($3.93 billion) by 3 percent compared to the previous year. Baidu said it estimates sales of $3.78 billion to $4.02 billion for the fourth quarter.

Analysts polled by FactSet had expected sales of $3.94 billion to boost earnings per ADS of $1.16.

Analysts expect adjusted profits of $1.22 per ADS for the fourth quarter and $3.97 billion in sales. This year, Baidu shares fell by 32 percent as the S&P 500 index SPX gained 23 percent by 0.07 percent.