Earthquake shaking arrives in waves: fast P-waves first, then the destructive S-waves.
Early-warning systems detect the harmless P-waves and race out an alert before the strong shaking hits.