Cuba neighbours to restore ties
They were the only two Central American countries to maintain a diplomatic freeze on the communist island-nation.
In El Salvador, the winner of this week's presidential election, Mauricio Funes, said ties would be re-established as soon as he takes office.
Announcing a similar move, Costa Rican leader Oscar Arias said: "We have to be capable of adjusting to new realities."
For Mr Arias, the decision represents a dramatic change in attitude.
He once compared Cuba's rights record under Fidel Castro to that of Augusto Pinochet's regime in Chile.
And Havana has labelled him a "vulgar mercenary" and a puppet of American imperialism.
In an official statement, Mr Arias said: "It no longer makes sense to continue an official rift when we have established channels of co-operation in various areas.
"We extend our hand to the Cuban people and we send an olive branch over the seas and through the air, to begin once again the good work of building friendship."
He said the two governments would appoint ambassadors in the coming weeks.
In El Salvador, Mr Funes of the FMLN - a former left-wing rebel group - had promised to restore ties with Cuba during his campaign.
El Salvador broke ties with Cuba after the communist revolution of 1959 and Costa Rica followed suit two years later.
The announcements come a week after the US Congress voted to lift restrictions on relations with Cuba imposed by the Bush administration.
Under the new rules, Cuban-Americans will be allowed to travel to the island once a year and send more money to relatives there.