TOKYO (Reuters) - Japan's Toshiba Corp (>> Toshiba Corp) said on Wednesday it has agreed to sell its prized semiconductor business to a group led by U.S. private equity firm Bain Capital LP, a key step in keeping the struggling Japanese conglomerate listed on the Tokyo exchange.

Toshiba said in a nighttime announcement through the exchange its board decided to sign a contract for the deal worth about 2 trillion yen ($18 billion) (£13.27 billion), the latest and perhaps final twist in a deal that only hours earlier had seen the company leading towards an agreement with its U.S. joint venture partner Western Digital Corp (>> Western Digital).

The decision to sell the world's No. 2 producer of NAND memory chips, first reported by Reuters on Wednesday, was made at a board meeting earlier in the day.

Toshiba said the agreement assumed the deal would weather legal challenges raised by Western Digital. A Western Digital spokeswoman said the company did not have an immediate comment.

(Reporting by Makiko Yamazaki; Editing by William Mallard)

Stocks treated in this article : Toshiba Corp, SK Hynix Inc, Western Digital