The company also said Chief Financial Officer Herman Yu has been appointed chief strategy officer, but will continue to serve as CFO until a successor is found.

Demand for the company's rapidly growing autonomous driving service and artificial intelligence-powered cloud products, in which it has been investing heavily, has helped diversify revenue sources and offset competition from giants such as Alibaba and ByteDance in its core advertising business.

Baidu spent about 15.9 billion yuan ($2.45 billion) in the quarter to ramp up its products, a 21% increase compared with a year earlier.

Baidu's video streaming affiliate, iQIYI, posted a 15% increase in advertising revenue and subscribers grew to 106.2 million by June, on the back of more original content.

Total revenue rose to 31.35 billion yuan from 26.03 billion yuan in the second quarter ended June 30, topping analysts' average estimate of 30.96 billion yuan, according to IBES data from Refinitiv.

Baidu is facing heightened scrutiny from Beijing's regulators who have raised concerns over data security and user privacy, targeting the country's tech giants.

The tightened scrutiny hasn't exerted a negative impact to its operations yet, Baidu Chairman and Chief Executive Robin Li said on a conference call.

Earlier this year, Baidu's autonomous driving unit Apollo launched paid robotaxi services, that operate without a driver behind the steering wheel, in Beijing and Guangzhou.

Its robotaxi services will be cheaper than human drivers in 2025, Li said. Baidu aimed to offer robotaxi services to 3 million users in 2023.

($1 = 6.4770 Chinese yuan renminbi)

(Reporting by Eva Mathews in Bengaluru and Yingzhi Yang in Beijing; Editing by Vinay Dwivedi and Bernadette Baum)