SoftBank Group Corp. said it agreed to take a majority stake in WeWork after securing a deal that could hand co-founder Adam Neumann a nearly $1.7 billion windfall and sever most of his ties with the troubled office-space startup.

WeWork, in danger of running out of cash in the coming weeks, chose a rescue offer from SoftBank over a competing proposal from JPMorgan Chase & Co., according to people familiar with the matter. It had asked both parties to submit proposals by a deadline Monday.

The deal, which the companies announced late Tuesday, values WeWork at about $8 billion, a far cry from what it was aiming for in an initial public offering earlier this year and even less than the $47 billion at which a January investment from SoftBank pegged its worth. It will give SoftBank a roughly 80% ownership stake in WeWork.

Mr. Neumann, who was forced out as chief executive after pushback from prospective investors scuttled the IPO, has the right to sell $970 million of shares, or about one-third of his stake, in a so-called tender offer in which SoftBank will buy up to $3 billion in WeWork stock from employees and investors.

The Japanese conglomerate, which already owns about a third of the company, will also extend Mr. Neumann credit to help him repay a $500 million loan facility led by JPMorgan, the people said. It will also pay him a $185 million consulting fee.