A 30 or 90-day visa will be automatically granted (it's the stamp in your passport book) upon entry for most people (see list of countries below for clarification). If you are only granted a 30-day visa, you can go to the immigration office and apply for an extension after you arrive to Costa Rica.
Citizens with valid passports from the following countries are granted a 90-day visa in Costa Rica upon arrival:
Germany, Andorra, Argentina, Australia*, Austria, Bahamas, Barbados, Belgium, Brazil, Bulgaria, Canada, Croatia, Chile, Cyprus, Denmark*, Slovak Republic, Slovenia, Spain, United States*, Estonia, Finland, France*, Hungary, Ireland, Iceland, Israel, Italy, Japan, Latvia, Liechtenstein, Lithuania, Luxembourg, Malta, Mexico, Montenegro, Norway*, New Zealand*, Netherlands*, Panama, Paraguay, Poland, Portugal, Principality Of Monaco, San Marino, Puerto Rico, Serbia, South Africa, United Kingdom Of Great Britain And Northern Ireland **, Czech Republic, Republic Of South Korea, Hellenic Republic (Greece), Romania, Vatican City, Singapore, Sweden, Switzerland, Republic Of China (Taiwan), Trinidad And Tobago and Uruguay
* Dependencies also receive 90-day visa
** Includes England, Wales and Scotland
Citizens with valid passports from the following countries are granted 30-day visas upon arrival to Costa Rica:
Antigua and Barbuda, Belize, Bolivia, Dominica, El Salvador, Russian Federation, Philippines, Fiji, Grenada, Guatemala, Guyana, Honduras, Northern Marianas, Marshall Islands, Solomon Islands, Kiribati, Maldives, Mauritius, Federated States Of Micronesia, Nauru, Palau, Kingdom Of Tonga, Samoa, Saint Kitts And Nevis, Saint Vincent And The Grenadines, Saint Lucia, Sao Tome And Principe, Seychelles, Suriname, Tuvalu, Turkey, Vanuatu and Venezuela