A tourist visa card (visada tarjeta del turista) is necessary for travellers from most nations. This visa, which is really little more than a piece of paper on which you list your vital statistics, costs between 15-25 CUC (or 15-25 Euro), depending on where purchased. It is usually valid for 30 days and can be extended once for another 30 days at any immigration office in Cuba - beyond this you would need a pretty good reason. Canadians are the exception, getting 90 days on arrival and can apply for a 90 day extension. Your passport needs to be valid at least six months past the end of your planned return.
Citizens of Antigua and Barbuda (28 days), Barbados (28 days), Belarus, Dominica, Grenada (60 days), Malaysia (90 days), Russia, Saint Kitts and Nevis, Saint Lucia, Saint Vincent and Grenadines and Singapore who can stay 30 days without visa.
It is important to note that there is also a departure tax of CUC 25, to be paid in cash when departing Cuba.
On arrival you must already have a legal housing booking (hotel or casa particular) for at least three days. If you've written in the name of a good hotel on the tourist card, the officials should rarely ask for proof.
Cuban customs can be strict, though they sometimes go easy on tourists.