History and Culture Information and Travel Guide. Vacation packages Book store. History of Costa Rica, Costa Rica travel guide, Costa Rica eBook and Books, Costa Rica facts, the government, Politics, Culture, Travel and Tourism in Costa Rica. Costa Rica gained independence from Spain as part of the Mexican Empire (1821–1823) and the Central American Federation (1823–1838). In 1824 it annexed much of the province of Guanacaste from Nicaragua. In the 1850s, Costa Rican troops joined Nicaraguans and Hondurans to defeat William Walker's pro-slavery filibusters. This campaign sparked proto-nationalist sentiment, and it was only then that the term nación began to be used to refer to Costa Rica rather than to all of Central America.