T-10 card is the best choice for traveling within Barcelona. For €10.20 you get 10 trips which you can use in any urban transport, including metro, bus, train and tram. You can buy T-10 in red vending machines at the metro stations. Be careful: T-10 is not sold neither in buses, nor in trams. T-10 is multipersonal, which means that several people can use it. One trip is valid for 1.5 hours, and you can transfer between different types of transport for free. For example, you can switch from metro to bus, or from tram to train.
If you are a fan of turnstile jumping or ticketless traveling, get ready to pay €100 fine if caught. A single trip ticket costs €2.15.
If you are visiting Barcelona for 2, 3, 4 or five days, you can buy an unlimited transport card Hola Barcelona.