Puerto Rico has come to terms with bondholders on how to divide sales-tax revenue among them, marking the largest debt settlement to date as the island works its way through bankruptcy.

Shares of insurers that have exposure to the island's debt surged on the news of the plan. MBIA jumped nearly 8 percent, and Ambac rose nearly 5 percent Thursday. Assured Guaranty, which has less insured exposure, moved 3.6 percent higher.

The agreement concerns investors who hold bonds issued by Puerto Rico Sales Tax Financing Corporation, also known as Cofina. It will slash the debt by about one-third and cut the amount of future debt payments by $17.5 billion.

The deal means Puerto Rico's government saves an average of about $425 million a year on debt payments for the next 40 years, according to a statement issued by the governor.

The investors will swap their old bonds for new ones under the plan, which still needs court approval. The senior Cofina bondholders will recover 93 percent of their investment and the junior creditors will get 56.4 percent.

The deal, announced Wednesday evening, is supported by creditors representing about $10 billion of the total $18 billion of outstanding Cofina debt, as well as the Oversight Board, which is overseeing the island's financial restructuring.

The agreement represents "a huge positive" for insurers, according to BTIG. Ambac, for example, has a net insured exposure to senior Cofina bonds of just under $805 million, or nearly 41 percent of the company's total exposure to Puerto Rico's debt.

Mark Palmer, an analyst at BTIG, also said it is a "significant positive" for MBIA, which has about $684 million of gross insured exposure to the senior bonds. Those bonds accounted for more than 20 percent of its gross insured exposure to Puerto Rico's debt.

Assured Guaranty insures $273 million of the junior Cofina bonds, but says it expects to offer the new bonds with insurance in the hope of recovering more than the projected 56.4 percent.

"The agreed terms represent a significantly better recovery when compared with recent market prices," Dominic Frederico, president and CEO of Assured Guaranty, said in a statement.

Assured Guaranty is hopeful that the nearly full recoveries seen for the senior Cofina bonds is a sign that a high level recovery is achievable for Puerto Rico's other top tier security, the General Obligation ("GO") bonds, which are backed by Puerto Rico's constitution. The insurer has $1.4 billion of exposure to the GO bonds, which make up the bulk of its insured Puerto Rico exposure.

If the agreement receives approval through a confirmation hearing, it will be the largest debt restructuring deal to date since the beleaguered island entered into bankruptcy-like proceedings more than a year ago.