there is a rule in the Spanish civil code, art. 591, for trees (2 metres from the boundary), and another for bushes (50 cm). However, as these rules are really old (1889) they have been outdated by the town halls, which stablish in each case, depending on the area etc, the minimum distances to build.
If you want to have this checked, you should go to the town hall. Please note that
a.- in the event something has been built without caring for this minimum distance, you can complain to the town hall and the neighbour might be obliged to demolish the building and also to pay a fine.
b.- the above is not valid if the neihbouring building was finished more than 4 years ago.
c.- Only in some cases, and depending on the town hall regulations, it is possible to reach an agreement so that the building might be erected legally at a shorter distance from the boundary, WITH THE NEIGHBOUR'S EXPRESS CONSENT.
Some people use this to blackmail the neighbour: whilst the neighbour is building, they do not say anything. Once the building is finished, they say:"either you pay me this ***** € or I submit a denuncia at the town hall, which will make you pay a fine and also to have it demolished"
For further information, we stay at your disposal.