There is a train station (RENFE) and now a Metro underground station at the airport.
You are likely to come in to terminal 2 unless you are flying Vueling – in which case terminal 1.
Follow the signs for the station – covered walkaway from terminal 2 – the new metro terminal is next to the overland station.
Metro takes you to Universidad where you can change onto Line 3 and access the rest of the metro system.
Train takes you to Sants where you can access Line 3 & 5 of the metro system.
You buy a airport ticket from the ticket machine to get into town – about 5 Euro one way I think. Different tickets for Metro and RENFE train though.
Once in town buy a T10, one zone ticket at the metro station – this gives you 10 journeys, you can this on the metro or bus. About 12 Euro I think.
Don’t lose your tickets as you need them to get out the station. Fixed price fine of 100Euro to leave if you have no ticket!
Aerobus is OK if you are heading to Plaza Cat in the centre – I think it stops at the Sants Station as well.
Train or metro is generally nicer from the airport.