Both are great countries to visit!! As many people mention it all depends on where you want to go and what you want to see. The northern part of the countries are slightly cooler in the summer and the southern parts may be unbearable to someone not used to the weather. As I personally live in Spain, I would recommend visiting here (and the northern parts of the country such as Galicia, Asturias, and the Basque Country are all great places to visit in the heat of summer). On the other hand, I do plan to personally spend a couple of weeks in the Italian country side this week.
Really it all boils down to what you want to see, eat, and how many tourist you want to deal with.
Best, Claudia
sincerelyspain.com