Yahoo Japan Corp. is blunting the impact of a large stock sale by a big shareholder, buying back about ¥221 billion ($2 billion) worth of its shares in a complicated deal with SoftBank Group Corp.

The deal was triggered by Altaba Inc., which warned in February that it would start divesting its 35 percent stake in Yahoo Japan, fueling a selloff of the web portal as investors braced for the prospect of more shares hitting the market.

Altaba was created last year when Yahoo Inc. was sold, so that its lucrative stakes in Yahoo Japan and Alibaba Group Holding Ltd. could be carved out.