Getting there is half the fun. One way (and I think the best way) to get to the top of Montjuïc is by funicular and cable car.
A funicular is a mountainside railway. Catch the funicular at the Paral·lel metro station. You can get there on lines L2 and L3 and your metro ticket is good for the funicular.
At the end of the funicular catch the cable car to the top. The cable car is an extra fee and you can get either a one way or return ticket. If you are up for it, get a one way ticket and walk back down the mountain. It is neither far nor strenuous so go for it. The cable car ride is short but has great views of the city. (Note, this is NOT the cable car that goes from the beach – that is a different one and does not go to the top of Montjuïc).
There is lots to do on the top of Montjuïc including visiting the castle. By the way, it is free every Sunday after 3:30.
On your way back down Montjuïc you will see some pretty fountains, as well as some more great views of Barcelona.