In an escalating battle between China’s dominant internet giants, Tencent Holdings Ltd. has teamed up with JD.com Inc., Alibaba Group Holding Ltd.’s main e-commerce competitor, to buy a stake in the No. 3 online retail player.

The two firms said they would pay $863 million for a 12.5% stake in Vipshop Holdings Ltd., whose website sells discounted fashion, accessories and cosmetics from global brands such as Lacoste and Columbia, a move that directly challenges Alibaba’s chokehold on the e-commerce industry.