Usually you can't go too wrong by the Med...
Barcelona is very much a year-round destination, so much so that there’s not really such a thing as an off season. The climate is Mediterranean, fairly temperate but often quite humid: July and August are the hottest months, but the sea breeze often comes to the rescue to keep it from being stiflingly so. In the winter you’ll want a nice warm coat.
The wettest months are September and October, but you may need an umbrella any time up to June; spring in particular tends to be changeable. January can be surprisingly sunny. In August many shops and restaurants close altogether.
If you can pick and choose, April and May are usually the most delicious months weatherwise, and June and September have the added attraction of festivals.