Complacent Madrid's lucky escape