Sumitomo Mitsui Financial Group <8316.T>, Japan's third-largest bank, will buy Citigroup's Japanese brokerage and key investment banking units for $5.9 billion in a deal likely to reshape Tokyo finance and create a banking powerhouse.

Citigroup said the sale would bring it a total cash value of $7.9 billion as it seeks to shore up its damaged finances ahead of a U.S. government stress test of its balance sheet.

The deal sees Sumitomo Mitsui (SMFG) pay 573.5 billion yen ($5.9 billion) for retail brokerage Nikko Cordial Securities and Citigroup's stock and bond underwriting businesses, giving it a scale to challenge Mitsubishi UFJ Financial Group <8306.T> and other rivals.

Citigroup said the deal was likely to generate it $2.5 billion of tangible common equity, with part of the deal value coming through 201 billion yen derived through the retention of excess cash or repayment of outstanding debt to the U.S. firm.

Retail broking has been a weak point for Sumitomo Mitsui, which has lagged behind top banks Mitsubishi UFJ and Mizuho Financial Group <8411.T>, as well top brokerage Nomura Holdings <8604.T>.

Nomura last year bought Lehman Brothers' operations in Asia, Europe and the Middle East.

The acquisition gives SMFG Japan's fifth-largest brokerage by operating revenue, more than 100 branches and a familiar brand.

The deal includes Citigroup's stock and bond underwriting in Japan, which Sumitomo Mitsui may merge with an existing joint venture, sources told Reuters this week.

SMFG has a joint venture in investment banking with Daiwa Securities <8601.T>, Japan's second-largest brokerage, known as Daiwa SMBC Securities.

The merged entity would rank a close second in the latest quarter to Nomura in yen bond and stock underwriting in Japan.

Citigroup put Nikko Cordial and an unspecified portion of its investment banking division up for sale as part of its global efforts to raise cash, having taken more than $85 billion in credit-related losses.

Citigroup spent about 1.6 trillion yen to acquire Nikko Cordial in a cash and stock transaction completed last year, as it sought to expand aggressively in the world's second-largest economy.

That plan was waylaid by credit losses that eventually caused it to take U.S. government support.

(Reporting by David Dolan; Editing by Ian Geoghegan)