Slovakia qualified for their first European Championship by beating Luxembourg, as Group C winners Spain defeated Ukraine in Kiev.