The climate in Barcelona is pretty pleasant throughout the year, but the best time to visit if you want to avoid the heat is during the months of May, June and July. Plus you will also find that it is still relatively warm during September as well.
However, if you are someone who finds heat difficult to cope with then avoid the month of August altogether. During this time of the year the temperature can reach the high 90 degrees Fahrenheit (mid 30 degrees Centigrade). Plus the actual climate can become somewhat humid and the city will feel almost like a sauna.
Although later in the year during October and November it still remains relatively warm in the city you will find that there is a lot less sunshine throughout the day. In some cases you may find that the skies are somewhat overcast and there is the increased chance of rain.
Certainly the coldest months of the year in this city occur between December and February and yet you will find it still sits at around a pleasant 53 degrees Fahrenheit (12 degrees Centigrade). But although you will get some sunshine there is a much higher probability of it raining during these months.
Because the city is located by the Mediterranean Sea it enjoys a very warm and welcoming climate throughout the year. So no matter what time of year you visit the city you are sure to enjoy yourself. Certainly during the winter and spring months in the city it is advisable to bring some clothing to protect you against the rain and the drop in temperatures.