The magnetic field around the Earth traps electrons and protons of energy 0.1-100 MeV. The dynamics of these particles is influenced by solar activity and the impact of intense geomagnetic storms on communication systems and infrastructures is widely recognised. So far, space weather models have been mostly based on data from electromagnetic probes, plasma probes and low-energy particle detectors. Fewer inputs are available from the highest energy range, 10-100 MeV, very important because particles are sufficiently fast to promptly probe large fractions of the ionosphere. To fill the gap, INFN and partners constructed the HEPD detector, launched on-board the CSES satellite on February 2nd 2018: HEPD will allow the use of the Earth magnetosphere as a giant magnetic spectrometer, using analysis tools similar to those used at magnetic detectors at particle accelerators with potential new application in the field of space science. This paper reports on particle detection technologies, event reconstruction algorithms and observational results of the HEPD detector, demonstrating how knowledge from high-energy physics can be successfully transferred to other fields of science and technology.