If you are a foreign student from a non-EU country who wish to study in Spain during a period longer than 3 months, you must obtain a temporary visa and a residence permit. You should apply for your visa before leaving your country of origin, before the closest Spanish Consulate in your home country. You should request your student card from the Spanish Ministry of the Interior (Ministerio del Interior) once you are in Spain.
If you are an EU-national wishing to studying in Spain during a period longer than 3 months, you don’t need to apply for your residence card (community card) anymore, although you can do so if you wish.
In addition to the documentation required to get the visa and the residence permit, foreigners from EU and non-EU countries must prove their registration in the Spanish educational center and present a certificate of studies provided by the center stating how long they will be studying there.
If your country of origin does not have a reciprocal health agreement with Spain, then you will not be covered by the Spanish Social Security and must get private health insurance in Spain. Therefore you should furnish evidence that you are insured upon application for your visa or residence card. EU-nationals must also prove their full coverage health insurance.
European Union and non-EU foreign students are also required to prove that they have sufficient economic means to support themselves in Spain.
Students may be allowed to get a part-time job. This is a situation considered exceptional: You must obtain a work permit and therefore you have to prove to the Spanish authorities that your activities will be compatible with your studies and that the income you receive is not necessary for your own living and permanence in Spain.
Before they start working students must get an authorization from the Foreigners’ offices (Oficinas de Extranjeros) or the Labor Government offices (Delegaciones o subdelegaciones del Gobierno, área de Trabajo y Asuntos Sociales). They must file a number of documents, such as their student card, employment contract, etc.