Nicaragua's congress on Tuesday accepted a $100 million loan offered by Taiwan, giving a line of support to President Daniel Ortega's government, which has become increasingly isolated after a brutal crackdown on protesters last year.
Lawmakers approved the 20-year loan a day after U.S. President Donald Trump declared that "socialism is dying" in Nicaragua, Cuba and Venezuela.
The United States enacted a law late last year making it harder for Nicaragua to access multilateral loans.
The bill approved by lawmakers from the ruling Sandinista party said the funds were destined to support the country's budget priorities this year.
Taiwan's Foreign Ministry said in a statement that the unrest in the country had caused serious damage to Nicaragua's economy.
"In order to help re-building work in Nicaragua, our side has agreed, after prudent assessment, to provide a commercial loan for re-building," it said.
"The relevant help is based upon humanitarian considerations to help the Nicaraguan people, and we hope people's lives in Nicaragua and social order can return to normalcy and stability as soon as possible," the ministry added.
"Nicaragua's government has promised to use this loan appropriately in the aforementioned areas," it said.
Nicaragua is one of a shrinking number of countries in Central America that still offer U.S.-ally Taiwan diplomatic support over China, which considers Taiwan sacred Chinese territory.
China and Taiwan have for years traded accusations of "dollar diplomacy" as they seek support around the world, offering generous aid packages in return for diplomatic recognition.
Self-ruled and democratic Taiwan now has formal relations with only 17 countries, almost all of them small and less developed nations in Central America and the Pacific, including Belize and Nauru.
China has never renounced the use of force to bring Taiwan under its control, and considers the island merely a wayward Chinese province, with no right to state-to-state relations.
Former guerrilla leader Ortega's rule was challenged by the protests against a social security reform last year. More than 320 people died in a crackdown that suppressed the protests but led to deep rifts with the private sector and Washington.
The United States has imposed sanctions on officials close to Ortega, including his wife, Vice President Rosario Murillo.
The Netherlands and Luxembourg last year suspended aid funding to Nicaragua, citing repression during the protests.
In the 2019 budget, Nicaragua's congress forecast a budget deficit of $320 million, up from $170 million in December 2018.