A social security number ( not to be confused with an NIE number) is only obtainable if you are becoming self employed OR if you have a written job offer in Spanish known as a “pre- contrato” OR if you are a foreign pensioner who has entitlement to health care funded by their home country.
Employees need to make a prior appointment by telephoning 922 60 25 10 and taking this application form together with the job offer, their NIE and their passport. From October 2018 these transactions will have to be undertaken electronically see here
Self employed people must make a prior double appointment by telephoning 922 60 25 10 and taking this application form and this one together with their Hacienda documentation modelo 36/37 and their passport and NIE From October 2018 these transactions will have to be undertaken electronically see here
EU Pensioners make an appointment at a different office this can be done on line here they must provide their S1 health entitlement documentation, green certificate of residence and passport