The 217-215 vote just after midnight adds six countries to the growing list of nations with free trade agreements with the United States and averts what could have been a major political embarrassment for the Bush administration.
CAFTA won Senate approval in June and now goes to President Bush for his signature. The U.S. signed the accord a year ago; it covers Costa Rica, El Salvador, Guatemala, Honduras, Nicaragua and the Dominican Republic.
It was an uphill effort to win a majority, with Mr. Bush traveling to Capitol Hill earlier in the day to appeal to wavering Republicans to support a deal he said was critical to U.S. national security.
To capture a majority, supporters had to overcome what some have called free trade fatigue, a growing sentiment that free trade deals such as the North American Free Trade Agreement with Mexico and Canada have contributed to a loss of well-paying American jobs and the soaring trade deficit.
Democrats, who were overwhelmingly against CAFTA, also argued that its labor rights provisions are weak and would result in exploitation of workers in Central America.
But supporters pointed out that CAFTA would over time eliminate tariffs and other trade barriers that impede U.S. sales to the region, correcting the current situation in which 80 percent of Central American goods enter the United States duty-free but American exporters must pay heavy tariffs.
The agreement would also strengthen intellectual property protections and make it easier for Americans to invest in the region.