No matter how you arrive to Madrid, you'll arrive somewhat outside the city center. The airport is no more than a $35 cab ride and all of Madrid is
accessible by a 10-30 minute Metro ride that is clean, comfortable and will only set you back 2€. To make it easy, be sure to ask for a "Billete Sencillo Metro+Suplemento". This is the basic Metro ticket plus an additional fare for the airport, which is further explained
here.