Retail chain Target Corp. (NYSE: TGT) has agreed to sell its consumer credit card business to Toronto-based TD Bank Group (NYSE: TD) for $5.9 billion.

The two companies also entered into a seven-year agreement under which TD will underwrite, fund and own future Target credit card and Target Visa receivables in the U.S.

Target, based in Minneapolis, sells clothing, electronics and household goods in more than 1,760 discount stores. It had been looking to divest the unit for roughly two years.

Andrew Faulkner of Skadden Arps Slate Meagher & Flom LLP represented Target on the deal. 

Simpson Thacher advised TD Bank, while First Annapolis was Target’s financial adviser.

In 2011, TD acquired the credit card portfolio of MBNA Canada, an issuer of MasterCard in Canada, from Bank of America Corp.