Shares of JD.com (NASDAQ:JD), China's biggest direct retailer and second largest e-commerce company, recently surged after its second-quarter numbers topped analysts' expectations.

JD's revenue rose 34% annually to 201.1 billion yuan ($28.5 billion), beating expectations by $1.2 billion. Its adjusted net income surged 53% to 3.51 yuan ($0.50) per ADS, also clearing estimates by $0.12.

Those headline numbers are impressive, but investors might be hesitant to buy JD's stock as it hovers near its all-time high. However, I believe this high-growth stock still has room to run, for five simple reasons.

JD's autonomous delivery vans.

Image source: JD.com.

1. Accelerating revenue growth

First and foremost, JD's revenue grew annually at its fastest rate in ten quarters:

Growth (YOY)

Q2 2019

Q3 2019

Q4 2019

Q1 2020

Q2 2020

Revenue

22.9%

28.7%

26.6%

20.7%

33.8%

YOY = Year-over-year. RMB terms. Source: JD.com.

It mainly attributed that growth to its annual 618 Grand Promotion, which occurred between June 1 and June 18 to commemorate the company's 22nd anniversary. Its total transactions grew 33.6% annually during this year's sale, accelerating from its 26.6% growth in 2019.

its sales of general merchandise rose 45% annually during the quarter and marked the category's strongest growth rate in nine quarters. Sales of electronics and home appliances also rose 28%, even as consumer spending in China remained wobbly after the COVID-19 crisis.

JD's supermarket category, including fast-moving consumer goods and fresh produce, also overtook its other categories as its top source of revenue in the first half of 2020. That growth, which is supported by a joint venture with Walmart, will likely widen JD's moat against Alibaba's Hema supermarkets.

2. Accelerating customer growth

JD's annual active customers grew 29.9% annually to 417.4 million in the second quarter, which also marked an acceleration from its previous quarters:

Growth (YOY)

Q2 2019

Q3 2019

Q4 2019

Q1 2020

Q2 2020

Annual Active Customers

2.4%

9.6%

18.6%

24.8%

29.9%

YOY = Year-over-year. Source: JD.com.

JD attributes its accelerating customer growth to its expansion across lower-tier cities in China. Over 80% of its new customers came from lower-tier cities, the highest percentage ever, throughout the second quarter.

To better serve those customers, JD launched a "lite" version of its app for older devices with slower connections, the Jingxi "social shopping" app (which mimics Pinduoduo's (NASDAQ:PDD) discount marketplace), built more regional warehouses, and expanded its selection of essential consumer goods and groceries.

JD's expansion across China's lower-tier cities spells trouble for Pinduoduo, which grew by encouraging those lower-income shoppers to team up on bulk purchases. But Pinduoduo remains unprofitable, due to its aggressive discounts and subsidies, while JD remains firmly profitable.

3. Expanding margins

JD's fulfilled gross margin fell 30 basis points annually to 8.3% during the second quarter, but that comparison was skewed by one-time benefits last year. Excluding those benefits, its fulfilled gross margin would have expanded.

JD's autonomous delivery vehicle.

Image source: JD.com.

Meanwhile, the increased scale of JD's first-party logistics network (JD Logistics) and tighter cost controls boosted JD Retail's adjusted operating margin 20 basis points annually to 3%. JD's total adjusted operating margin, which benefited from JD Logistics processing deliveries for other companies, also expanded 70 basis points to 2.8%.

JD's rising margins should silence the critics, many of whom claimed the company would stay unprofitable. Alibaba (NYSE:BABA) co-founder Jack Ma, for example, famously claimed JD's decision to take on inventories and fulfill its own orders (as opposed to Alibaba's model of simply providing product listings for merchants) would end in a "tragedy".

JD's margins remain much lower than Alibaba's, but its logistics and infrastructure investments are now generating stable profits. This tighter ecosystem serves as a foundation for its newer warehouse robots, autonomous delivery vehicles, and drones -- all of which will boost its operating efficiency and reduce its long-term operating expenses.

4. Ecosystem expansion

JD is exercising tighter cost controls, but it continues to expand its ecosystem with new services like JD Health, its online pharmacy and telehealth platform which grew its online consultations over 400% in the first half of 2020, and JD Cloud, which supports its own marketplace and provides digital services to other companies and government agencies.

JD expands its ecosystem more carefully than many of China's other tech giants. For example, Alibaba loses money on its streaming services, movie production unit, and other disparate businesses that aren't related to its core e-commerce and cloud businesses every quarter.

5. Robust growth with a reasonable valuation

JD didn't offer any guidance, but analysts expect its revenue and adjusted earnings to grow 25% and 29%, respectively, in USD terms this year.

JD's stock isn't cheap at over 40 times forward earnings, but its accelerating growth, expanding margins, and exceptional financial discipline all justify that slight premium. Therefore, investors shouldn't be afraid to accumulate shares of this high-growth stock, even as it hits new historic highs.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.