The Organisation of American States has urged Nicaragua and Costa Rica to withdraw their security forces from a disputed river border, where there has been tension for a month.
In a resolution, the OAS said the two countries should begin urgent talks to resolve their differences.
Costa Rica accuses Nicaragua of deploying troops inside its territory on an island in the San Juan river.
Nicaragua insists the island is on its side of the border.
Costa Rica welcomed the OAS resolution as a "diplomatic victory" after 22 countries voted in favour, with only Nicaragua and its ally Venezuela voting against.
But Nicaragua says the organisation does not have the authority to rule on border disputes, and says it will not withdraw its troops.
Nicaraguan president Daniel Ortega said the OAS vote was "manipulated" by a "conspiracy" that wanted to stop Nicaraguan troops from tackling drug-trafficking in the region.
He added that Nicaragua was considering withdrawing from the OAS.
The San Juan river marks the border between the two countries but an island at its mouth, known as Isla Calero in Costa Rica and Harbour Head in Nicaragua, has been disputed for more than a century.
Nicaraguan troops set up a camp there last month in support of a dredging operation.
Costa Rica, which has no army, responded by sending armed police to the region.
Costa Rican President Laura Chinchilla has accused Nicaragua of "invading" her country.
Thousands of Costa Ricans marched in the capital San Jose on Saturday in support of a peaceful solution.
Police have tightened security outside the Nicaraguan embassy in the city after a petrol bomb was thrown at the building.
Costa Rica has complained that the Google maps website fuelled the dispute by showing the island on the Nicaraguan side of the border.
Google has admitted making an error and has now revised its map.