At both the geographical and cultural centerpoint of Spain lies Madrid, a city that also embodies a large selection of Spanish culture and custom in its food. If you're one for snacks, there are tapas joints in endless profusion, although symbolic Spanish dishes like paella (a varied dish of meat, vegetables, and rice) and jamón serrano (a thinly sliced ham) or gallinejas (lamb intestine, a delicacy found primarily in Madrid) are great to sit down and devour in larger portions. Madrid is also home to a high number of international restaurants, so don't feel that you need to eat genuine Spanish food the whole time. Just be aware that meals will generally be eaten later than Americans expect; lunch starts at 1pm and dinner starts at 8pm.
First off, if you're going to want quality Spanish dishes, you're going to have veer from the sidewalk posterboards of Plaza Mayor and Puerta del Sol. The most popular neighborhood for tapas and beyond is La Latina, where a horde of Spanish restaurants, cafes, and bars gather around Calle Cava Baja. Most places have outdoor seating and the bustle of the street is an invitation to spend a whole afternoon and evening trying the endless variety of tapas, some of which can be quite interesting. The main institution of the area is Casa Lucio, while a block north is the oldest operating restaurant on Earth, Botin. La Latina in general may be your best combination of vibrant atmosphere, quality food, and moderate prices.
There are still good places to eat near the more touristy areas (the aforementioned public squares), but you really have to dig a bit more. One of the many Museo de Jamon's in Madrid can be found just east of the Puerta del Sol; try this place for its ham-centric decor and dishes, which come quite cheaply and with plenty of locals. The old world vibes of Casa Labra and the surprisingly un-touristy en Busca del Tiempo and Taberna Malaspina (across the street from each other) are musts if you don't want to travel too far from the sights.
The very chill Malasaña district also has a wide distribution of establishments that are somewhat off the tourist path. If you want to check out an excellent place before everyone on Tripadvisor does, we suggest La Tita Rivera, Petisqueira or Restaurante Albur. Delicious, American-style burgers can be had at the delicious Home Burger, which has a couple of locations.
There is also a fantastic concentration of restaurants in the few blocks north and northeast of the Parque del Retiro in Salamanca. Calle del Doctor Castelo has a number of tapas and Spanish restaurants; Taberna Arzábal has an exceptional reputation. Calle de Jorge Juan has a more international array of establishments, including Japanese and Mexican.
Madrid is a large city whose scope cannot be fully covered here. Luckily, there are devoted activity pages for individual eateries and the option to add those we don't cover; take a look and get prepared to eat your way through Madrid!