There are some very interesting mountains near Barcelona. Such as the Montseny Massif, and Montserrat, located in the Catalan pre-coastal mountain range.
Not so close to the city of Barcelona (3 hours by public transportation), in the province of Girona, lies the Cap de Creus (Cape Creus), another good example of whimsical landscape shapes. In the same province of Girona one can find the Alta Garrotxa, rugged rocky landscape.
On a personal note, these are some of the mountains of my country, where I started hiking and climbing. I also spent quite a lot of time in those mountains because of my work. For some years I worked in fire prevention campaigns, as a forest rang. It allowed me to get to know some of those territories in a different way, a little more from within.
In those mountains there are a number of very different trails – just a little over an hour from the city of Barcelona, except Cap de Creus and the Alta Garrotxa, which are a bit farther. Many of those trails can be accessed using public transport. Some of those trips take only two days, excellent to combine with a visit to Barcelona city.
Those sites offer a variety of scenery, very attractive geology, trails, and summits to climb, from which the views over much of Catalonia and the Mediterranean Sea can be enjoyed.