There are several options:
Aerobus: private company bus. You can buy your ticket inside the bus. The bus stops in Pl. Espanya, Pl. Universitat and Pl. Catalunya.
Train R2: from terminal T2. Single ticket costs here. There are automatic ticket machines next to the station.
Metro L9Sud: subway (orange line). It departs from both terminals (T1 and T2). There are automatic ticket machines next to the station.