Wal-Mart Stores Inc. (NYSE:WMT) has announced its intentions to sell its online business in China to JD.com, the country’s largest e-commerce site when measured by revenue and second largest by market share. As part of the deal, JD.com will control the brand, website and app for e-commerce platform Yihaodian, and Wal-Mart will retain the subsidiary’s direct sales business. Wal-Mart, in return, will receive a 5 percent stake in JD.com through the company’s issuance of nearly 145 million newly issued Class A shares.

Doug McMillon, president and CEO of Wal-Mart, called JD.com a “very complementary business and ideal partner,” and said that the two companies share similar values. Both companies will leverage their supply chains and broaden the range of imported goods through the partnership. Wal-Mart will also benefit from JD.com’s huge customer base and its same-day delivery network.

Traffic has declined at Wal-Mart’s 400 stores in China as Chinese shoppers are increasingly migrating online to shop for food and household goods. Wal-Mart’s global online business has also seen sales growth slow. In the first quarter, Wal-Mart reported that its global e-commerce sales rose 7 percent year over year. That is far below the 20 percent increases seen less than two years ago and weaker than the 8 percent growth reported in the previous quarter.

The online marketplace has become very competitive as JD.com, Alibaba, and a swarm of smaller, online food sellers are all fighting for marketshare. Wal-Mart previously had just 1.6 percent of China’s overall online market, coming in sixth place in the industry, according to research firm Euromonitor International. For comparison, Alibaba commands 46.9 percent of marketshare and JD.com controls 20.1 percent.

JD.com currently has nearly 6,000 delivery and pickup stations located in about 2,500 counties and districts across China. Yihaodian owns and operates only about 250 hubs. Last August, JD.com announced plans to purchase a 10 percent stake in Chinese store rival Yonghui for its fresh food expertise. It also launched an app last year that allows shoppers to order fresh foods and groceries online and have them delivered to their homes within two hours.

Wal-Mart is hoping that the partnership will bolster its presence in the Chinese online marketplace. The company has already positioned itself as a source for high-quality food after numerous food safety scandals in the country. Now, the company is focusing on catering to middle-class shoppers with imported food and premium goods.

Get Analysts' Upgrades and Downgrades Daily - Enter your email address below to receive a concise daily summary of analysts' upgrades, downgrades and new coverage with MarketBeat.com's FREE daily email newsletter.