Yes and no. In the tourist hot-spots of cities such as Madrid, Barcelona & Málaga, which means the historic centres we would say forget about it - all have freezes and no new short-term letting licences will be issued for the foreseeable future. Away from the cities, in general it is possible but if you buy a property without an existing licence you will have to get one. First, you need explicit permission from the Community of Owners to do so, before applying for a licence, and many Communities have already banned new licences.
However, a recent ruling by the regional government in Andalucía, the Junta, has clarified a couple of points which helps buyers in that region. They ruled that a licence is granted to a property that meets the regulations, not an individual, and therefore, an existing licence stays with the property and a new owner may let short-term if they wish. Furthermore, any subsequent ban by a Community of Owners does not cancel a tourist rental licence providing the licence predates the ban. For more detail read my blog.
Nevertheless, we suggest keeping up-to-date with what's going on in the tourist letting sector if it is relevant to your property criteria as this ruling can be appealed and may fall. If it stands, I would expect prices of properties with a letting licence to rise and other regions to follow suit.