The spanish geographical institute has all vectors of spanish maps (including city/buildings) for free. You just have to register. You can easily open the needed layers via QGIS and extract everything you need in desired format.
The data is stored here: IGN Centro de Descargas