After nearly 13 hours of debate, Argentina’s senate on Thursday approved a deal to pay its holdout creditors, removing the last legislative hurdle the measure faced, and ending a 15-year-long battle that had restricted the South American nation’s access to international credit markets.

Under the terms of the deal — approved with 54 votes in favor to 16 votes against — Argentina will shell out nearly $4.7 billion to repay U.S. hedge funds and holdout creditors, which had taken the country to court in New York, where the debt was issued. The Argentine government will now repay nearly 75 percent of what it owes to hedge funds managed by Paul Singer’s Elliott Management Corp, Aurelius Capital, Davidson Kempner and Bracebridge Capital.

The measure also allows the government to issue over $12 billion in new bonds, which would then be used to resolve disputes related to its 2001 economic crisis, which forced the country default on $100 billion in debt.

Since then, Argentina has been essentially locked out of the international credit markets, and has resorted to issuing domestic bonds and borrowing funds at nearly double the rate paid by its neighbors. The country now has until April 14 to repay its creditors.

The passage of the deal, finalized in February and approved by the House of Deputies earlier this month, marks a significant victory for pro-market President Mauricio Macri, who had made the debt crisis a cornerstone of his presidential campaign. Earlier, the newly-elected leader of the cash-strapped nation had warned lawmakers against a “no” vote, stating that it could turn Argentina into a global “financial pariah.”

Macri’s reconciliatory tone is a marked departure from his predecessor Cristina Fernández de Kirchner’s, who steadfastly refused to negotiate with what she derisively called “vulture funds,” seeking to rob the Argentines.

Since he came to power in November, Macri — an avowed free-market capitalist — has been trying to shift gears away from his predecessor’s protectionism by devaluing the peso, removing import restrictions and slashing export taxes.

“Argentina needs to have a political culture that is more responsible, that acts in the country’s best interest and not on behalf of some short-term calculation,” Daniel Lovera, an Argentine senator from La Pampa, told the Wall Street Journal.