Malaga left it late to overcome Segunda Division side Eibar 4-1 and reach the Copa del Rey quarter-finals after a drawn first leg.