The first occupancy license ( in Spanish Licencia de primera ocupación or cédula de habitabilidad) is issued by the technical department of the town hall.
It basically certifies that the building meets all standards and it is ready to be used for the purpose of living there.
It your property is part of a complex, a building or an urbanisation, this might have been granted to the whole building.
You can obtain a duplicate from the town hall.
Having the first Occupancy license is a requisite to be able to run a Holiday Letting business from your property. Failing to meet this requisite will bring a fine of 2000€.
If you have your house built or it is so old that never got one in the first place, you might need the assistance of a professional. Normally the one indicated to do this job is an architect or technical engineer with experience in dealing with your local town hall.