All citizens of the United States, Canada, Western European nations, plus Australia and New Zealand need a valid passport to enter Costa Rica. No visas are required. Tourist cards are issued during your flight or at the immigration desk upon arrival and permit stays of 90 days. Citizens of China and most Asian, Middle Eastern, and African countries are either limited to entry for up to 30 days or need a visa.
The law requires that you carry your passport or tourist card with you at all times during your stay. Make photocopies of all documentation and keep them with you, separate from the originals. (A recent attempt to crack down on illegal immigration has resulted in many innocent tourists being carted off to jail to face a bureaucratic minefield.)
You can request a tourist card extension (prórroga de turismo) monthly for up to 60 days ($3 per month) from the immigration office (Migración, tel. 506/2299-8026, www.migracion.go.cr [1]), on Highway 166 in La Uruca (8:30 a.m.–3:30 p.m. Mon.–Fri.) and regional immigration offices around the country. You’ll need three passport-size photos, a certified copy of your outbound ticket, a certified copy of all pages in your passport, and a written statement of the reason for your extension. Be sure to begin the process before your 30 or 90 days are up. Since you’ll need to allow three days minimum—plus an additional four days or more if you are asked to submit to a blood test for AIDS—it may be just as easy to travel to Nicaragua or Panamá for 72 hours and then re-enter with a new visa or tourist card.
If you extend your stay illegally beyond the authorized time, you may be deported (deportees are not allowed back in for 10 years). You will also not be allowed to leave without first obtaining an exit visa ($50), which means a trip back to the immigration office, plus a visit to the Tribunales de Justicia for a document stating you aren’t abandoning any offspring or dependents in Costa Rica. Exit visas take 48 hours or more to process; a reputable attorney or tour operator can usually obtain what you need for a small fee.
If you plan on staying beyond the 30 or 90 days, you may be required to show proof of being free from AIDS or its precursor, HIV. The Ministerio de Salud, Ministry of Health, Calle 16, Avenidas 6/8, can oblige.
Links:
[1] http://www.migracion.go.cr