Madrid Atocha has luggage lockers open 05:30-22:20 Mon-Fri, 06:15-22:20 Saturdays, 06:30-22:20 Sundays. Small locker €2.40, medium €3, large €4.50. The lockers are in the old trainshed with the tropical gardens, at the far right-hand end as you walk away from the modern train departure concourse. There's an X-ray check of all bags entering locker area.http://www.seat61.com/luggage-lockers-at-stations.htm#Left_luggage_offices_&_lockers_in_Spain