To get the stay permit for the purpose of studies, you must apply to the Provincial Aliens Affairs Office. (in Spanish)
To study in Spain you must:
Within a month of your entry into Spain you must apply for an authorization for a study stay at the Foreign Office in Zamora.
You must prove:
[See you below the address and requeriments]
This certificate can be extended for as long as you are registered at the EASD. The duration of the stay permit for the purpose of studies is equal to the length of the course for which you have been admitted and is renewable.
This permit shall be extended annually if you show that you continue to meet the original conditions required for the first permit and that you meet the requirements for the activity.
More on studying in Spain (in Spanish)
All non-EU/EEA foreign students wishing to remain in Spain for a period of more than 90 days are required to apply for a Long-Term student visa. You can only apply for your visa from the Spanish consulate or embassy that has jurisdiction in your country of permanent residence. The student visa is granted for the whole duration of the course and it is renewable.
Once you are in Spain, you must apply for authorization to stay during the course of your studies at the Foreign Office:
OFICINA DE EXTRANJERÍA EN ZAMORA
The following requirements must be met:
The International Relations Coordinator of the EASD in Zamora will send a letter of acceptance to your university which is needed in order to apply for the student visa before coming to Spain.
Take this letter of acceptance to the Spanish embassy or consulate in your country to begin processing yourvisa application.