The Spanish language is spoken in many different countries and differences in vocabulary and pronunciation exist.
Learning a new language is always difficult. But it really helps if you want to get the most out of your stay. Try to start the learning process before you travel. Watch Spanish-language films, television, radio or documentaries. If possible, watch Costa Rican films (there are few), or get some exposure to radio stations online. Read as much as you can Spanish. If you live somewhere where there are native Spanish speakers, you might want to advertise for a language exchange partner – someone who wants to swap conversation practice.
After you arrive
Practice is the best way to learn the language. As soon as you arrive in the country, mingle with the locals. Talk to as many people as you can. Costa Ricans are friendly and open, so it is easy to start a conversation (harder to keep up depending on your level). Taxi drivers, market vendors, people on the bus, conversations can take place easily. Do not worry about making mistakes when talking; you will learn from your mistakes. Listen to the pronunciation and the melody/rhythms of the language. A lot of vocabulary can be learned through daily contact.
A common mistake many language students learning in a foreign country should be avoided. It is very tempting to speak Spanish in class and talk other languages with your fellow students after class. Of course, you can spend time with your fellow students. However, if you really want to learn the language, establish contact with the locals too. It might be hard at first due to the fact that it takes more effort to communicate, but this is the best way to learn.