We were in Costa del Sol last summer around the same time. It's farther south than Barcelona, but I can tell you that Spain is hot. Very hot! Our itenerary was such that we alternated one day on the beach with one day sight-seeing, driving up and down the coast and going into Granada and up into the mountains etc. So we did more sight-seeing than you are planning.
I will say that I overpacked and ended up not wearing about half of what I brought! What I found most useful:
1) Beach cover-ups. Take at least three, esp if you have no access to a washing machine. They get sandy and greasy from sunscreen. While people may have no problem going topless on the beach, you'll find they are modest and cover up when going to and from.
2) Good, strong, dark sunglasses. At least two pairs in case one breaks. Strong sunscreen with high SPF. And if you are fair, consider a head wrap to protect your scalp.
3) Loose and cool day dresses made of cotton or linen, sleeveless (spaghetti strap if you can wear them). Esp for your sight-seeing day, if you are going inland. It was too hot for clamdiggers and shirts with any sort of sleeve.
4) Pashmina or cardi for night time, because it can get cooler. Where we were... not much cooler! But if you get a sunburn you might end up chilled. You will also want to take a wrap or cardi with you if you plan to visit any cathedrals; you must cover up your shoulders. If you visit a mosque, the pashmina is preferable because you can throw it over your head too.
5) You don't need to be too dressy. The parts of Spain we visited were pretty casual - the natives not just the tourists. The exception was this one town, Nerja, that attracted a lot of european tourists, it was more upscale and people dressed very nicely. Otherwise, most of the places we visited including Madrid were quite casual.
When we were not on the beach, I pretty much lived in three sundresses. I tried walk shorts with tank tops but even that was too hot for me. Loose, flowy sundresses worked best.
You will not want to wear too many layers or even belts... so bring along a lot of jewelry to accesorize and liven up your outfits.
And comfy shoes are a must! Cobblestones and lots of steep hills (at least where we were staying).
The spanish schedule is quite an interesting one: everyone sleeps in late and lunch isn't until 2-4 pm and then dinner is very late at night, around 9 pm. People stay up until at least 2 AM. My teens really loved that schedule - it fit their natural rythyms much better.