yes it can be bought legal cbd in Spain.

Each country has its own legislation in relation to any substance or food. CBD in Spain does not appear on any marketing list. Does that make it an illegal substance? No, that makes it an "illegal" substance. Namely, there is no legislation on CBD.
So can you buy CBD legally? In the legislation on free trade between the countries of the European Union and according to the opinion of the court of justice, it is clearly interpretable without any doubt that CBD products purchased in other countries (provided that their sale is authorized in these countries) can be marketed in Spanish territory. Therefore the marketing is governed by international conventions and national and international jurisprudence.
Control of Cannabidiol (CBD)
Spain takes as a reference the 1961 Single Convention on Narcotic Drugs where cannabidiol (CBD) is not controlled. At the time this list of narcotics was made, there was still no knowledge about the existence of CBD. CBD was discovered 3 years after the preparation of said list, in 1964 by Raphael Mechoulam. Anyway it has been proven with different studies that CBD not only it is not psychoactive but it is not addictive either.
Control of THC
Let us remember that the THC substance is on this list and that the extractions of cannabis resins and tinctures are also on this list. This could lead to a general interpretation of extractions and therefore CBD, despite not being a narcotic, could be interpreted as these resin extractions from the cannabis plant.
CBD regulation and jurisprudence
In relation to Spain, the Superior Court of Justice of the European Union issued a ruling in December 2020 that framed jurisprudence that is very favorable to the commercialization of CBD. The sentence was such that: “any member state of the European Union may not prohibit the marketing of legal CBD in another member state if it is extracted from the plant cannabis sativa in its entirety and not just its fibers and seeds.
Each product must be subject to the regulation of the country of origin, with its relevant quality controls. Within the European Union there are still few countries that recognize CBD for their respective marketing.
Currently you can find products with a high CBD content such as CBD flowers in physical stores and in many online stores such as 4Collectors.

The AEMPS < CBD relationship
The AEMPS (Spanish Agency for Medicines and Health Products has a position against legalizing CBD-based products. In the case of a regulation of pharmaceutical products, the AEMPS would be the body that would regulate the processes and the requirements of the drugs for their commercialization.
The only drug approved by the AEMPS based on cannabidiol (CBD) is Epidiolex by the pharmaceutical company GW Pharma.
Will there be any kind of financial interest between the pharmaceutical companies and the AEMPS?