Both cities have direct flights all year from London, Frankfurt, Warsaw and Belgrade. Both are major hubs, and from London the flight is about the same (2h20 to Barcelona, 2h30 to Madrid). Barcelona is closer from the rest by 45-50 minutes: about 2 hours from Frankfurt against 2h45, 3 hours from Warsaw against 3h50, and 2h45 from Belgrade against 3h35. It's a modest edge, but on a two or three day trip it counts.
Both airports link to the center without a car. In Madrid, metro line 8 reaches Nuevos Ministerios in about 15 minutes (with a 3 EUR airport supplement), and the Cercanías C-1 train reaches Chamartín and Atocha. In Barcelona, the R2 Nord train runs from Terminal 2 to Sants in about 20 minutes, the L9 Sud metro serves both terminals with a 5.90 EUR airport ticket, and the Aerobús is the third option. Both centers are walkable and a car isn't needed in either.
Which to fly into? For one city, fly into that one. For both, the cheaper habit is an open-jaw ticket, into one city and home from the other, which saves a 3-hour train back. From central and eastern Europe, start or end in Barcelona to keep the shorter flight on one leg, and compare the two directions on your dates, because fares differ more than flight times do.
The train between them is the AVE: Renfe (AVE and Avlo), Iryo and Ouigo all run it. Ouigo's own timetable lists direct trains in 3h02 and trains with stops in 3h18-3h27. The line used to be advertised at about 2.5 hours, but in February 2026 the operators and Adif agreed to add 25 minutes to the schedule, reported to run to the end of 2026, so check the current time when you book.