Before to come to Spain you have to find out if you will need to get a Visa to travel from your home country. At the web of the Spanish Foreign Office you will find complete information

If your are NOT from a EU country, Iceland, Liechtenstein, Norway or Switzerland probably you will need a long length national Visa.

Anyway, we recommend you to consult with the Spanish Embassy or Consulate in your country. The requirements could be different depending on your period of stay. Also very often, agreements between countries changes.

Remember to ask about those other conditions to access to Spain apart of the Visa.