China's JD.com Inc reported better than expected second-quarter revenue on Tuesday, boosted by stronger sales in its online retail business, sending its shares 5% higher in pre-market trading.

The company's net revenue rose 23% to 150.28 billion yuan ($21.28 billion) in the second quarter ended June 30. Analysts were expecting revenue of 147.49 billion yuan, according to IBES data from Refinitiv.

The online retailer's upbeat results provided a bright spot in China's e-commerce industry and wider tech sector which is slowing down after years of growth.

Companies like JD.com and bigger rival Alibaba are seeking to diversify beyond online shopping to deal with the slowing growth.

JD.com has entered new businesses, such as convenience stores and supermarkets. It is also investing in AI to improve its logistics and advertising capabilities.

Last week the company announced it led a $142 million funding round in Xinchao Media, which runs ads in elevators across China.

The company has also sought outside funding for several of its subdivisions, including its health division, its finance division, and its logistics division.

On a company earnings call, executives noted that JD Logistics, JD's business unit which oversees warehousing and delivery for itself and other merchants, broke even during Q2.

Industry analysts say that Chinese ecommerce firms have largely tapped China's online spenders in the country's first-tier cities, and must aggressively court consumers in less affluent parts of the county.

Jerry Liu, who tracks China's internet sector at UBS Investment Research Securities, says that China's e-commerce industry has performed better than others anticipated since the start of the year, as online consumption growth is still relatively stronger despite the economic slowdown.

"Big ticket items, like cars or smartphones, might be more challenging," he told Reuters.

"But if you look at smaller ticket, higher frequency products, that's still doing well."

On an earnings call, the chief strategic officer elaborated on how the company would attempt to attract customers from lower-tier cities in China.

Initiatives include working directly with manufacturers to offer private-label goods, and revamping the site's accessibility on WeChat, China's most popular mobile chat app.

JD has endured its troubles over the past year. At the start of 2019, it laid off a number of mid- and senior-level employees. Founder Richard Liu, meanwhile, fought allegations of sexual harassment against a Chinese national which first surfaced in the United States one year ago.

JD.com's shares rose to $28.49 in premarket trading on Nasdaq.

Net income reached 618.8 million yuan ($90.1 million), up from a net loss of 212.4 million the year prior. The company posted non-GAAP EPS of 2.30 yuan, trumping estimates of 0.46 yuan.

Sales from its product business, which includes online retail sales, rose about 21% to 133.52 billion yuan.

For the third quarter, JD expects revenue between 126 billion yuan and 130 billion yuan, the mid-point of which was above analysts' estimates of 126.21 billion yuan.

($1 = 7.0625 Chinese yuan renminbi)

(Reporting by Akanksha Rana in Bengaluru and Josh Horwitz in Shanghai; Editing by Jane Merriman and David Evans) ((akanksha.rana@thomsonreuters.com; within U.S. +1 646 223 8780, outside U.S. +91 80 6749 1130;))