JD.com posted its first-ever quarterly profit since becoming a public company with the integration of Walmart Stores. The web business in China and strong spending by consumers has driven a surge in online sales.

China’s second largest company in the e-commerce industry after just Alibaba Group had been the benefactor of an increase in online shopping across a country that has patchwork infrastructure for retail.

JD, which acquired Yihaodian in 2016 a local platform from China that was owned by Walmart, posted 239 million yuan or $35 million in net income for its quarter ending March 31.

It was the first time it posted net income since it became public in 2014 and surpassed expectations of a loss of 851 million yuan. Sales increased by 41% to over 76.1 billion yuan which also beat expectations of 73.5 billion yuan.

JD announced a plan to form a spinoff of its online finance and payments division in a deal worth billions that might close during the current quarter.

That increases its cash to help bankroll the drone and warehouse delivery networks it is building to become one of the dominant players in e-commerce across Asia.

However, the race to build networks for logistics and to attract clients could continue to weigh on its 2017 margins.

JD said it is expecting revenue to increase by between 35% and 39% to reach 88 billion to 90.5 billion yuan during the ongoing quarter, in comparison with an estimate by analysts of 89 billion yuan.

The company, which billionaire Richard Liu founded, is investing a great deal in delivery logistics as well as new markets that range from women’s fashion to groceries, looking to find new revenue streams.

Its strategy will be focusing on better overall service to improve customer loyalty and their willingness to buy. However rivals like Alibaba are not sitting still.

One analyst with Credit Suisse said that groceries have become an important category at JD to attract the female customer, improve frequency of purchase and margin profile.

Due to a continued battle with rival Alibaba, JD may now begin to spread its wings into Indonesia as well as other countries in Southeast Asia. JD is said to be holding talks to invest millions of dollars into the e-commerce platform in Indonesia called Tokopedia, which could help it to form a basis for a larger push into that region.

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.