There is also a Questions and Answers thread HERE.
Here is the procedure at the National Police station for this. It's pretty straight forward so I will tell you what is needed, though you can get an A4 sheet in the Police Station that clearly shows what documentation is needed..
1. Passport. Original and copy.
2. Completed Formulario de Solicitud which you can download and print
HERE
3. Certificado de Empadronamiento and photocopy. Link on that
HERE.
4. Payment of a fee of 6.80 euros using form Modelo 790. You need to collect this from the police station as it is a carbonated triplicate. Don't queue just ask at the desk as you go in and they will give you one. They will give you form 2 above if you are unable to download it.
5 1 photo.
You can get 4 photos done for 5 euros in the copier shop straight opposite the Police station. It's under Las Terrazas apartment. Look for the Kodak sign.
They are open Monday to Friday 9.00 until 14.00. He advised to get there at before 7am to get a ticket at 9am as they will only see 50 people per day.
One further point. The explanatory notes on the form you download from my link have not been updated so are out of date but the part of the form you complete is fine. The EX16 I got at the Police Station has updated notes on it but they assured me you can still use the form I have given you the link for. In fact the explanatory notes they gave me show you the website address to download it from.