Wal-Mart Stores Inc. and JD.com have a $1.5 billion deal structured as a “strategic alliance.”

The two companies said their agreement covers both online and offline. The alliance allows Wal-Mart to expand its online presence in China, with JD.com acquiring ownership of the discounter’s Yihaodian marketplace platform assets. Wal-Mart will continue to operate the Yihaodian direct-sales business, while the two companies will work together on growing the Yihaodian brand and business under its current name and market position. Yihaodian has a strong presence in eastern and southern China. As part of the agreement, Wal-Mart will receive nearly 145 million newly issued JD.com Class A ordinary shares, representing about 5 percent of JD.com’s total shares outstanding, for its investment in JD.com. The estimated deal value of $1.5 billion is based on JD.com’s $30 billion market capitalization.

Wal-Mart in 2011 made its first investment in Yihaodian, a Chinese online grocery business founded in 2008 and operated as a business-to-consumer site. A year later, the American discounter raised its investment to a 51 percent controlling stake. In 2015, Wal-Mart acquired the balance of the company it didn’t already own.

Charlie O’Shea, lead retail analyst at Moody’s Investors Service, said, “Wal-Mart’s investment in JD.com through its contribution of Yihaodian for an approximately 5 percent ownership stake in JD is a significant event, and is credit-positive for Wal-Mart in both the short-term and long-term.” The analyst added that the agreement “provides Wal-Mart with an expanded entrée into the Chinese market with a partner that has, in our view, the best-developed online business model in global retail, due to its proprietary delivery network, which provides it with true ‘last-mile’ capability, which we believe is a critical advantage.”

O’Shea explained the “last mile” advantage, noting that JD’s proprietary delivery is rare in online retail. There is no reliance on [the equivalent of] a FedEx or U.S. Postal Service. They do it themselves. That ultimately is the name of the game. Who’s got the last mile? You want to control that. Even with a really good service level, there’s still slippage when you have a third party….JD’s model takes that out of the equation and gives Wal-Mart a real quality player in the Chinese market.”

Sam’s Club China, Wal-Mart’s warehouse club operation, will open a flagship store on JD.com, and will offer same- and next-day delivery through JD.com’s nationwide warehousing and delivery network.

The agreement also provides for the two companies to link their supply chains.

According to O’Shea, “We see an awful lot of white space going forward that the two will be able to exploit.” The analyst, who said Wal-Mart has always been known for its logistical focus, also believes that there are “certainly things Wal-Mart can learn from JD on the delivery front” that Wal-Mart “can bring here.”

Doug McMillon, Wal-Mart’s president and chief executive officer, said, “JD.com shares similar values in making the lives of customers better. It also has a very complementary business and is an ideal partner that will help us offer compelling new experiences that can reach significantly more customers. We also look forward to offering customers a tremendous number of quality imported products not previously widely available in China through Wal-Mart and Sam’s Club.”

Richard Liu, ceo of JD.com, said, “Wal-Mart is synonymous with trusted quality, efficient retailing and we believe that this tie-up will increase both product selection and overall user experience.” Liu added that Sam’s Club’s unique, high-end product selection “meets the demand from China’s increasing affluent consumers for high-quality, imported products and has already proven popular in the Chinese cities where it has stores.”

Cowen’s Oliver Chen said that because Wal-Mart’s China stores will be listed as a preferred retailer on JD.com’s O2O JV Dada — China’s largest crowd-sourced delivery platform — the new status is expected to drive increased traffic to Wal-Mart’s stores in China since JD.com’s customer base can now order fresh food and other items from Wal-Mart stores. Chen noted that Wal-Mart operates 430 stores in China.