It´s usual in Spain leave a tip in bars and restaurants, not as big as in other countries like USA, because here tips are a complement of the personnel salary. There is not a fixed tip %.
If you have been in a bar eating or drinking something, and this has cost you 3.70 € for example, you can leave 20 or 30 cents as a tip, just leaving some of the coins from the change back. In a restaurant, depending on the number of persons eating and the amount of the bill: for example for a bill of 40-50 € for 2 you can leave between 3 and 5 €, for a bill of 120-150 € for 7-8 people you can leave between 7 and 15 euros. It could be 1 or 2 € per person, or leaving the money rest when you calculate or round the part of the bill each person will have to pay.
My opinion is that we should leave a tip if we liked the meal, and if the service from the personnel is good (they are nice and helpful, they smile, if they do their job properly). Tip will depend on these factors, being bigger or smaller depending on how we feel about the meal and service. And if the personnel have been disgusting in any manner, I would not leave a single cent.