The first natives in Costa Rica were hunters, and gatherers, and Costa Rica served as an intermediate region between Mesoamerican and Andean native cultures.
In the late 1400's Christopher Columbus made landfall in Costa Rica. Soon after, his forces overcame the indigenous people. He incorporated the territory into the Captaincy General of Guatemala as a province of New Spain in 1524. For the next 300 years, Costa Rica was a colony of Spain. As a result, Costa Rica's culture has been greatly influenced by the culture of Spain. During this period, Costa Rica remained sparsely developed and impoverished.
Following the Mexican War of Independence (1810–1821), Costa Rica became part of the independent Mexican Empire in 1821. Subsequently, Costa Rica was part of the Federal Republic of Central America in 1823, before gaining full independence in 1838. Its economy struggled due to lack of connections with European suppliers. In 1856, Costa Rica resisted United States settlers from mounting a take-over of the government.
After 1869, Costa Rica established a democratic government.
After the Costa Rican Civil War in 1948, the government drafted a new constitution, guaranteeing universal suffrage and the dismantling of the military. Today, Costa Rica is a democracy that relies on technology and eco-tourism for its economy. Although poverty has declined since the turn of the 21st century, economic problems still exist. Costa Rica is facing problems of underemployment, foreign and internal debt, and a trade deficiency.
The oldest evidence of human occupation in Costa Rica is associated with the arrival of groups of hunter-gatherers about 10,000 to 7,000 years BC, with ancient archaeological evidence (stone tool making) located in the Turrialba Valley, at sites called Guardiria and Florence, with matching quarry and workshop areas with presence of type clovis spearheads and South American inspired arrows. All this suggests the possibility that in this area two different cultures coexisted.
The people of this era were nomadic. They were organized in family-based bands of about 20 to 30 members. Their usual prey animals were called megafauna, such as giant armadillos and sloths, mastodons, etc. These became extinct about 8,000 years before the modern era. The first settlers had to adapt to hunting smaller animals and develop appropriate strategies to adjust to the new conditions.
The northwest of the country, the Nicoya Peninsula, was the southernmost point of Nahuatl cultural influence when the Spanish conquerors (conquistadores) came in the sixteenth century. The central and southern portions of the country had Chibcha influences. The indigenous people have influenced modern Costa Rican culture to a relatively small degree. In the years soon after European encounter, many of the people died due to infectious diseases, such as measles and smallpox, which were endemic among the Europeans but to which they had no immunity. The Diquis culture flourished from 700 CE to 1530 CE and were well known for their crafts in metal and stonework.
The colonial period began when Christopher Columbus reached the eastern coast of Costa Rica on his fourth voyage on September 18, 1502. Numerous subsequent Spanish expeditions followed, eventually leading to the first Spanish colony in Costa Rica, Villa Bruselas , founded in 1524.
During most of the colonial period, Costa Rica was the southernmost province of the Captaincy General of Guatemala, which was nominally part of the Viceroyalty of New Spain (i.e., Mexico). In practice it operated as a largely autonomous entity within the Spanish Empire. Costa Rica's distance from the capital in Guatemala, its legal prohibition under Spanish law against trading with its southern neighbors in Panama, then part of the Viceroyalty of New Granada (i.e., Colombia), and the lack of resources such as gold and silver, resulted in Costa Rica attracting few inhabitants. It was a poor, isolated, and sparsely inhabited region within the Spanish Empire. a Spanish governor in 1719 described Costa Rica as "the poorest and most miserable Spanish colony in all America." 
Many historians say that the area suffered a lack of indigenous population available for forced labor, which meant that most of the Costa Rican settlers had to work their own land. This prevented the establishment of large haciendas. For all these reasons Costa Rica was by and large unappreciated and overlooked by the Spanish Crown and left to develop on its own. The small landowners' relative poverty, the lack of a large indigenous labor force, the population's ethnic and linguistic homogeneity, and Costa Rica's isolation from the Spanish colonial centers in Mexico and the Andes, all contributed to the development of an autonomous and individualistic agrarian society. Even the Governor had to farm his own crops and tend to his own garden due to his poverty. The failure to build a colonial society based indigenous and slave labor led to a peasant economy in the 1700s
During the time of conquest, as many as twenty distinct indigenous societies, numbering in the hundreds of thousands and speaking many different languages, inhabited the area The Spanish conquest of Costa Rica lasted more than half a century after it started 1510. The genocidal enslavement of the indigenous societies of Nicoya on the Pacific North coast was the conquest’s first stage. Its second phase began with fruitless attempts to consolidate a Spanish settlement on the country’s Caribbean side. In the process, Spaniards reduced the indigenous population to the point of extinction through disease, war, reprisals, relocation and brutal exploitation. The Native American population stood at about 120,000 in 1569 and had fallen to 10,000 by 1611.[disputed ]
In the early 19th century, Napoleon's occupation of Spain led to the outbreak of revolts all across Spanish America. In New Spain, all of the fighting by those seeking independence was done in the center of that area from 1810 to 1821, what today is central Mexico. Once the Viceroy was defeated in the capital city—today Mexico City—in 1821, the news of independence was sent to all the territories of New Spain, including the Intendencies of the former Captaincy General of Guatemala. Costa Rica joined the other Central American Intendancies in a joint declaration of independence from Spain, the 1821 Act of Independence.
On October 13, 1821 the documents arrived at Cartago, and an emergency meeting was called upon by Governor Juan Manuel de Cañas . There were many ideas on what to do upon gaining independence, such as joining Mexico, joining Guatemala or Nueva Granada (today Colombia). A group was declared (Junta de Legados), which created the temporary Junta Superior Gubernativa de Costa Rica . Meanwhile, "the clouds clear up" ("Mientras se aclaraban los nublados del día"), was a famous phrase of the events of the day.
Independence from Spain was acknowledged and ratified on October 29, 1821 by the colonial authorities. It was then ratified in the cities of San José on November 1, 1821, at Cartago on November 3rd, 1821, at Heredia on November 11, 1821, and Alajuela on November 25th, 1821.
After the declaration of independence, the New Spain parliament intended to establish a commonwealth whereby the King of Spain, Ferdinand VII, would also be Emperor of New Spain, but in which both countries were to be governed by separate laws and with their own legislative offices. Should the king refuse the position, the law provided for a member of the House of Bourbon to accede to the New Spain throne. Ferdinand VII did not recognize the colony's independence and said that Spain would not allow any other European prince to take the throne of New Spain.
By request of Parliament, the president of the regency, Agustín de Iturbide, was proclaimed emperor of New Spain, which was renamed Mexico. The Mexican Empire was the official name given to this monarchical regime from 1821 to 1823. The territory of the Mexican Empire included the continental intendancies and provinces of New Spain proper (including those of the former Captaincy General of Guatemala) (See: History of Central America). On 5 April 1823 the Battle of Ochomogo was fought between forces from Cartago who wanted to join the Mexican Empire and those who preferred to remain independent. The Republicans won and the capital was moved from Cartago to San José.
In 1823, a revolution in Mexico ousted Emperor Agustín de Iturbide. A new Mexican congress voted to allow the Central American Intendancies to decide their own fate. That year, the United Provinces of Central America was formed of the five Central American Intendancies under General Manuel José Arce. The Intendancies took the new name of States. The United Provinces federation, not strongly united to begin with, rapidly disintegrated under the pressures of intra-provincial rivalries.
Following full independence in 1838, Costa Rica had no regular trade routes established to export their coffee to European markets. Lack of infrastructure caused problems in transportation: the coffee-growing areas were mainly in the Central Valley and had access only to the port of Puntarenas on the Pacific coast. Before the Panama Canal opened, ships from Europe had to sail around Cape Horn in order to get to the Pacific Coast. In 1843, the country established a trade route to Europe with the help of William Le Lacheur, a Guernsey merchant and shipowner.
In 1856, William Walker, an American filibuster, began incursions into Central America. After landing in Nicaragua, he proclaimed himself as president of Nicaragua and re-instated slavery, which had been abolished. He intended to expand into Costa Rica and after he entered that territory, the country declared war against his forces. Led by Commander in Chief of the Army of Costa Rica, President Juan Rafael Mora Porras, the filibusters were defeated and forced out of the country. Costa Rican forces followed the filibusters into Rivas, Nicaragua, where in a final battle, William Walker and his forces were finally pushed back. Juan Santamaría, a drummer boy from Alajuela who lost his life torching the filibusters' stronghold, was killed in this final battle. He is today remembered as a national hero.
An era of peaceful democracy in Costa Rica began in 1869 with elections. Costa Rica has avoided much of the violence that has plagued Central America. Since the late nineteenth century, only two brief periods of violence have marred its republican development. In 1917–19, Federico Tinoco Granados ruled as a dictator.
In 1948, José Figueres Ferrer led an armed uprising in the wake of a disputed presidential election. "With more than 2,000 dead, the 44-day Costa Rican Civil War resulting from this uprising was the bloodiest event in twentieth-century Costa Rican history." The victorious junta drafted a constitution guaranteeing free elections with universal suffrage and the abolition of the military. Figueres became a national hero, winning the first election under the new constitution in 1953. Since then Costa Rica has been one of the few democracies to operate without a standing army. The nation has held 16 successive presidential elections, all peaceful, the latest being in 2018.
Costa Rica's economy went under a transformation in 1978. The country went from being "an economic development success story" to entering a severe socio-economic crisis. Costa Rica relied on the exportation of bananas and coffee. In 1978, coffee prices dropped, and its revenues declined. In 1979, the price of oil, a main imported item, increased sharply and rapidly, plunging the country into crisis. In order to help improve the economy, President Rodrigo Carazo continued to borrow money internationally. This led the country into further debt.
Once a largely agricultural country, Costa Rica has transformed to relying on technology industry and services, and eco-tourism. Costa Rica's major source of export income is technology-based. Microsoft, Motorola, Intel and other technology-related firms have established operations in Costa Rica. Local companies create and export software as well as other computer-related products. Tourism is growing at an accelerated pace, and many believe that income from this tourism may soon become the major contributor to the nation's GDP. Traditional agriculture, particularly coffee and bananas, continues to be an important part of Costa Rica's exports.