The Costa Rican health system is considered the best of all of Latin America with European or American standards, the facilities are good and accessible to all, tourists and foreigners from around the world are entitled to emergency treatment at public hospitals without any difficulty or complications (of course if you do not have an insurance the service is a fee).
The main public hospitals are in the capital as Hospital San Juan de Dios and Hospital, Mexico are highly recommended for the quality and service offered, in Guanacaste in Nicoya and Liberia (30/50 minute drive from Tamarindo) there are a good hospital.
As a resident is required to pay to the CCSS (Caja Costarricense de Seguro Social) a monthly amount based on income and allows you to go to any public hospital to receive all the medical care and medication at no charge !! (Including foreigners).