The first thing you have to know is whether you can get permission from the Town Hall to build your house. The permit is called licencia de obra. You should know that building permits cost around four per cent of the estimated construction cost.
Other thing to consider is that in Spain, the land is classified as follows:
Urban Land, land for development ( suelo urbano)
Green zones, where no building can take place ( zonas verdes)
Country land, rural areas, where no construction is permitted (suelo rústico)