Costa Rica means 'coast of wealth', however it is unclear whether Christopher Columbus invented the term when he arrived in the region on his fourth and last expedition in 1502, or the conqueror Gil González Dávila, who landed on the west coast in 1522.
In any case, the promise of gold on this fertile coast prompted Spanish invasion, and Costa Rica became part of the Kingdom of Guatemala, which also encompassed the modern-day republics of Nicaragua, Honduras, El Salvador, and Guatemala, as well as the Mexican state of Chiapas.
Spain had been weakened by its engagement in the Peninsular War in Europe, and local juntas had formed when local Spaniards rose against the reign of King Joseph, Napoleon's brother, who had been placed as ruler of Spain by the French.
This desire for self-rule lasted when King Ferdinand ascended to the Spanish throne, and the Province of Guatemala declared Central America's independence on September 15, 1821.
Following independence, and despite objections from El Salvador, the areas were part of the Mexican Empire until 1823, when they submitted to form the Federal Republic of Central America.