The governments will be reimbursed over 15 years
The Icelandic parliament has voted in favour of repaying more than $5bn (£3bn) to the governments of the UK and the Netherlands.
The so-called Icesave bill will reimburse funds paid by the governments to compensate those who lost money in the Icelandic online bank Icesave.
About 400,000 savers lost their money when its owner Landsbanki collapsed last year.
The bill has enraged many in Iceland, who fear it might bankrupt the nation.
The deal was agreed in June, but was only passed after an amendment was added setting various limits to the payments.
The Icesave bill's passage means that the Icelandic government has agreed to guarantee the repayment of the £2.3bn loan the UK government made last year to ensure that none of its savers lost money.
The amendments will now have to be agreed by the UK and the Netherlands.
"It is my sincere hope after this vote, that the UK and Holland will show us understanding and fairness in this matter," Iceland's Prime Minister Johanna Sigurdardottir said after the vote in parliament.
The amount that will be paid is limited based on the level of Iceland's economic output, or gross domestic product (GDP).
The country will have to pay up to 4% of its GDP each year to the UK and 2% to the Netherlands.
No payments will be made for the next seven years, but the bill says that if the full payments have not been made by 2024 then no further payments will be made. Effectively, there is only an eight year window for the loans to be repaid.
The amendments to the bill were added by MPs to try to soften the impact of the legislation.
Some members of parliament have questioned why the government should be repaying the debts of a private bank.
In the vote, 34 members voted in favour, 14 voted against and there were 14 abstentions.
There is particular anger at the UK for using anti-terror laws to freeze Icelandic banking assets in the UK when the crisis began last year.
Chancellor Alistair Darling was also accused of undermining confidence in the Icelandic banks.
Iceland eventually had to take over its three biggest banks - Glitnir, Kaupthing and Landsbanki, which owned Icesave.
In a statement, the UK Treasury said, "As you would expect, the UK will look carefully at any conditions placed upon the loan to ensure that they are reasonable".
Iceland hopes that the agreement to make payments to the UK and the Netherlands will help it to get more financial aid.
It does not cover the money councils invested in Icelandic banks. They are engaged in a separate process to recover their money, led by the Local Government Association.
As part of that process Nottingham City Council, which lost £42m, received a first payment on Friday of £2.5m.