Central American nations have reached an agreement to allow several thousand Cuban migrants stranded in Costa Rica for over a month to continue their journey towards the United States.
The migrants will be airlifted to El Salvador and put on buses, which will take them to the US.
American legislation gives Cuban migrants preferential treatment.
If they arrive at the US border by land they are allowed to enter the country and apply for residency.
Those who are intercepted at sea are sent back, under the special immigration policy known as “wet foot, dry foot”.
Many Cuban migrants fear that the thaw in relations between Washington and Havana may put an end to the preferential treatment given to them.
“We have agreed to make the first humanitarian transfer in January,” said foreign ministers from the Sica regional group and Mexico.
They met in Guatemala City to try to find a solution to the crisis.
Cuba did not attend the meeting, but said it expected “a quick and adequate solution” from the nations involved.
“I strongly believe that the politicisation of US migration policy toward Cuba must change,” said Cuban Foreign Minister Bruno Rodriguez.
The current crisis began in November when Nicaragua, a close ally of Cuba, denied access to thousands of migrants arriving from Costa Rica. The Cuban government says an estimated 7,000 migrants have been living on the Costa Rican side of the border since 14 November.
Many of the migrants flew from Cuba to Ecuador, which did not require Cubans to have visas. Ecuador has since changed its visa policy for Cubans.
From Ecuador, the Cuban migrants travelled north through Colombia, Panama and Costa Rica until they were stopped by Nicaragua.
The move has caused tension between Costa Rica and Nicaragua.
Costa Rica had called for the creation of a “humanitarian corridor” to allow the migrants to continue their long journey to the US border, about 2,400 km (1,500 miles) away.
On Sunday, Pope Francis urged Central American nations to show generosity in dealing with the crisis.
“I invite the countries of the region to renew with generosity all necessary efforts in order to find a rapid solution to this humanitarian drama,” the Pope told tens of thousands of people at the Vatican’s St Peter’s Square.
The Pope said many of the Cubans passing through Central America were victims of human trafficking.