Current scenario:
If you are from outside the EU and you were given a student visa, you will notice that if you look at your passport, your visa has been issued only for 3 months. Don´t panic! It is like this for all non EU students. That means that once you reach to Spain, you have up to 3 months to obtain the TIE card (Tarjeta de Identificación de Extranjero). Once you obtain your TIE, you student visa period will be extended. This is a protocol that all students from outside the EU need to follow. 

Who should apply for TIE:
Only non EU citizens on a student visa for Spain need to apply for TIE.

Steps to obtain your TIE (and extend your student visa period for more than 3 months):
1. Making an appointment here:
Select your province and select the option "POLICÍA-Toma de huellas (expedición de tarjeta) y renovación de tarjeta de larga duración.

2. Fill out your personal details:
-You will be asked to type your passport number, name, lastname, country of nationality. You might be requested to type a Spanish number, if you still do not  have it, you can give any other Spanish number of reference.
-Important: Leave the "Fecha de caducidad de su tarjeta actual" date blank unless you are renewing your TIE.

3. My region is not showing in the list or there are not online available appointments:
In that case, you will need to go to the police station or foreign office directly.

4. Applying for the TIE card:
In order to apply for the TIE card, you need to go to the corresponding police station in your area and bring with you the following documentation:
-Appointment confirmation (print-out)

-Original passport and photocopy of your passport showing your personal details.
-Photocoph of the page of your passport where the police put a stamp on your first entry in Spain or any Shengen territory (does not have to be Spain as long as it is  withing Shchengen country).
-2 Passport pictures
-Filling out the Form 790-CODIGO 012 and paying the fee. You can download the form here:

Instructions to fill out the form 790:
-Insert your passport number
-Click on "autoliquidación", then click on "principal", then click on "TIE que documenta la autorización de residencia de larga duración o de residencia de larga duración-UE"
-Certificate of enrolment in the city council "Empadronamiento", original and copy  (Some police stations might ask for it. Check out the police station of your region whether  it is compulsory in your region or not).

-TIE application form EX17. You can download the document here. You only need to fill out sections 1, 3 and 4 (leave section 2 in blank). 
-In section 4.1, choose "tarjeta inicial"

-In section 4.2, choose "Estancia por estudios, investigación-formación, intercambio prácticas o voluntariado".

-Click on the box close to "CONSENTIMIENTO la comprobación de mis datos de identidad a través de la plataforma de los sistemas de verificación de datos de identidad".

With all these documents, along with your fingerprints (huellas), they will process your application.

The office will either give you an appointment to collect your TIE card or ask you to go back after 30 days to pick it up.