Travelling with the metro in Barcelona is a fast and cheap option. Tickets are fair value, one ride will cost you €2,20 and 10 rides €10.20.
They operate by color and once you have figured out the metro map it is pretty easy and fast to travel around the city. On what type of ticket to buy depends on your needs.
Most people would take a day pass (€8.60) but this is only profitable if you do many rides on one day and it is only for 1 person´s use. In most cases the T10 (€10.20) will be the best option, it gives you 10 rides and you can pass the card to other people if you should be traveling in a group. Another option is the Barcelona Card (€41.50) this offers you free public transport ( also to and from the airport) and many cultural and leisure activities free or at a reduced price.
Such as the best of Gaudi at La Pedrera and the Casa Batllo, the Picasso Museum, Barcelona Zoo, the Museu Nacional dÁrt de Catalunya and other museums.
To buy metro tickets you can do this in the metro station at a vending machine with cash or credit card. Do be aware of pickpocketing on the trains as it is a favorite place for thieves to operate when it is very busy.