The President of Costa Rica, Oscar Arias, has said the country has given its backing to a free trade agreement with the United States.
Costa Rica is the only country to hold a referendum on the issue
With most of the votes counted, Mr Arias said the treaty had been narrowly approved in a referendum.
The treaty gives Costa Rica greater access to the US market.
Opponents of the deal fear increased competition could ruin the country's successful economy and put the welfare system at risk.
"The people of Costa Rica have said yes to the free trade agreement, and that for me is a sacred wish," Mr Arias said in a televised address to the nation.
With 89% of votes counted, 51.7% backed the treaty.
Five other Central American countries have already ratified the agreement.
Costa Rica is the only country to hold a referendum on the Central American Free Trade Agreement, which will also cover Guatemala, El Salvador, Honduras, Nicaragua and the Dominican Republic.
Correspondents say its adoption by Costa Rica will be welcomed by Washington, which is keen to maintain its influence in Latin America to counter that of socialist leaders in Venezuela and Cuba.
Supporters of the trade pact say it is a unique development opportunity that will benefit Costa Rica since it is a small country with few natural resources.
But critics object to requirements that Costa Rica open its telecommunications and agricultural sectors to greater competition, and fear it may flood the market with cheap imports.
Costa Ricans have for many years enjoyed more stability and a higher standard of living and public services than their neighbours in Central America.
Earlier Mr Arias said a "No" vote would undermine that position.
"Costa Rica would be saying 'no' to a market of 300 million inhabitants, and that would be a grave error," he said.
The issue has provoked repeated protests in Costa Rica, including a two-day strike by public workers last year.