Yahoo says it will return $3 billion to shareholders after selling back about half of its 40% stake in Chinese company Alibaba for $7.1 billion, according to documents filed with the SEC.

Alibaba Group Holding, an online marketplace based in China, repurchased its 523 million shares from Yahoo for $7.1 billion.

That includes a payment of $6.3 billion in cash and $800 million in so-called "preference shares" from Alibaba to buy back its stock, providing a much-needed cash injection for Yahoo.

The company, led by new Chief Executive Officer Marissa Mayer, has suffered through lackluster earnings.

Yahoo (YHOO) had previously returned $646 million to shareholders through stock repurchases. The company did not disclose whether the additional $3 billion will be returned in the same manner.

Related: 10 most powerful business people in China

Back in 2005, Yahoo had sold the Hong Kong part of its business to Alibaba and also bought a stake in the company.

As part of the repurchase deal, certain limitations on the ability of Yahoo to compete in China will be lifted, and restrictions on Alibaba's ability to operate outside of China will also be lifted, according to the filing late Tuesday.