Shock waves, the interface of supersonic and subsonic plasma flows, are the primary region for charged particle acceleration in multiple space plasma systems, including Earths bow shock, which is readily accessible for in-situ measurements. Spacecraft frequently observe relativistic electron populations within this region, characterized by energy levels surpassing those of solar wind electrons by a factor of 10,000 or more. However, mechanisms of such strong acceleration remain elusive. Here we use observations of electrons with energies up to 200 kiloelectron volts and a data-constrained model to reproduce the observed power-law electron spectrum and demonstrate that the acceleration by more than 4 orders of magnitude is a compound process including a complex, multi-step interaction between more commonly known mechanisms and resonant scattering by several distinct plasma wave modes. The proposed model of electron acceleration addresses a decades-long issue of the generation of energetic (and relativistic) electrons at planetary plasma shocks. This work may further guide numerical simulations of even more effective electron acceleration in astrophysical shocks.