Alibaba is to buy back half of the 40% stake owned by Yahoo, following several years of tough negotiations between the two firms.
Yahoo will earn around $7.1bn (£4.5bn) from the deal, comprised of at least $6.3 billion in cash and up to $800 million in newly-issued Alibaba preferred stock.
The move allows the privately owned Alibaba Group to consider an initial public offering.
Yahoo, which last week lost its chief executive Scott Thompson over discrepancies on his CV, will benefit from the Alibaba deal with a cash injection to mount acquisitions, buy back its own shares and pay dividends.
Ross Levinsohn, the interim chief executive of Yahoo!, said: "Today's agreement provides clarity for our shareholders on a substantial component of Yahoo's value and reaffirms the significance of our relationship with Alibaba.
"We look forward to continued collaboration with the Alibaba team on business initiatives as we explore joint opportunities for growth and benefit from Alibaba's future."
Yahoo chief financial officer Tim R. Morse added: "We look forward to delivering the proceeds of the near-term transaction to our shareholders, and to the further enhancement of value and the additional monetization in the future that this agreement enables."
Under the deal, Alibaba will be able to buy more of Yahoo's remaining 20% stake, if the firm forges ahead with the sale of its own shares on stock markets.
Alibaba has been locked in negotiations for several years over buying back its shares, but the talks have suffered various setbacks.
Jack Ma, the chairman and chief executive of Alibaba Group, said that the transaction "opens a new chapter" in his company's relationship with Yahoo.
"I look forward to working with Ross Levinsohn and the Yahoo team as Alibaba builds China's leading e-commerce company," said Ma.
"Yahoo's global audience reach will provide attractive partnership opportunities for Alibaba to explore markets outside of China. The transaction will establish a balanced ownership structure that enables Alibaba to take our business to the next level as a public company in the future."
In addition to the share repurchase, the agreement also gives Alibaba a transitional licence to continue operating the Yahoo China service in China for up to four years.
Alibaba will pay an upfront royalty payment to Yahoo of $550 million, and continuing royalty payments for the period of licence.