JD.com (NASDAQ:JD), the largest direct retailer and second largest e-commerce player in China, has struggled over the past two years with slowing sales growth, rising expenses, a rape allegation against founder and CEO Richard Liu, and escalating trade tensions between the U.S. and China.

However, JD's top-line growth stabilized last quarter, its margins improved, and the charges against Liu were dropped. As JD moves past those headwinds, investors might be wondering if it's a good long-term investment at these levels.

A JD.com delivery robot.

Image source: JD.com.

After all, JD trades at just 0.7 times this year's sales estimate and remains down about 30% over the past two years. To find the answer, we should examine JD's growth potential over the next decade instead of the next few quarters.

JD's long-term plan

JD is different from Alibaba (NYSE:BABA) in two main ways: It takes possession of the goods sold on its platform, and it fulfills orders with its own warehouses and logistics network. Alibaba doesn't take on inventories, it just facilitates transactions between individuals and businesses, and mainly relies on third-party courier services.

Therefore, JD's business model is more capital-intensive but less exposed to unscrupulous sellers than Alibaba's. Alibaba co-founder Jack Ma once claimed that JD's capital-intensive push would end in "tragedy", but JD's strategy of running a tighter ship is paying off: Alibaba's Taobao was placed on the U.S. House of Representatives' blacklist of "notorious" marketplaces for counterfeiters, but JD wasn't.

JD has much lower operating margins than Alibaba, but it plans to expand its long-term margins with three main strategies. First, it's automating its fulfillment and logistics services with warehouse robots, delivery drones, and autonomous delivery vehicles. Second, it's offering its logistics services (JD Logistics) to other retailers as a service. Lastly, it's generating revenue from newer businesses -- like online ads, cloud services, and overseas investments -- to diversify away from its core JD Mall business.

JD's long-term challenges

JD's long-term plans are ambitious, but it faces plenty of competition. Pinduoduo (NASDAQ:PDD), for example, recently overtook JD in terms of total active buyers. JD still generates much more revenue, since Pinduoduo mostly sells cheaper products in bulk to lower-income shoppers, but Pinduoduo's growth indicates that there's still room for disruptive newcomers in China's crowded e-commerce market.

The other big rival is Alibaba, which still dominates the e-commerce space with four major marketplaces: its business-to-consumer (B2C) platform Tmall, its consumer-to-consumer (C2C) platform Taobao, its business-to-business (B2B) platform Alibaba.com, and its overseas marketplace AliExpress. Alibaba currently controls 55.9% of China's e-commerce market according to eMarketer, putting it far ahead of JD's 16.7% share.

A JD.co delivery drone.

Image source: JD.com.

But JD still has some big backers in its corner. Two of its top investors are Tencent (OTC:TCEHY) and Walmart (NYSE:WMT). Tencent integrates JD Mall into WeChat, the most popular messaging platform in China with over 1.1 billion monthly active users, while Walmart offers pickup points for JD at its stores, pools its customer data with JD's, and offers grocery delivery services with JD through a joint venture.

Alphabet's Google is another major investor, selling JD's products in several overseas markets via Google Shopping. Simply put, JD is a favorite partner for companies that want to counter Alibaba.

So where will JD.com be in ten years?

China's economic growth is decelerating, but it should easily maintain a low- to mid-single-digit GDP growth rate over the next decade. The Economic Intelligence Unit expects China's middle class to account for 35% of the population by 2030, up from just 10% in 2015, and China's internet penetration rate of 60% should continue climbing as incomes rise and networks improve.

Those growth rates indicate that JD's number of annual active customers, which hit 310.5 million last quarter, should rise over the next decade. Meanwhile, its profitability should improve as it moves past its tech and infrastructure investments, while its scale and first-mover's advantage should hold smaller challengers like Pinduoduo at bay. If those tailwinds kick in, today's prices will look like a bargain in ten years.