If you decide on the train it is at Chamartin station which is 2 transfers on the metro from the airport but generally 45 - 55 minutes including a 10-15 minute walk in the airport to the terminal if you arrive in terminal 1 as most int'l flights. If you want to buy in advance the easiest way is...