We present results on photon echo spectroscopy for resonant excitation of localized charged exciton complexes (trions) in CdTe/CdMgTe semiconductor quantum wells. We demonstrate that the Zeeman splitting of resident electron spin levels in transverse magnetic field leads to quantum beats in the photon echoes with the Larmor precession frequency. This allows us to perform a coherent transfer of optical excitation into a spin ensemble and to observe long-lived photon echoes. Our approach can be used as a tool for remarkably high resolution spectroscopy of the ground state levels: We are able to resolve splittings between the spin levels with sub-μeV precision and to distinguish between different types of electrons in the ensemble, namely electrons either bound to donors or localized on quantum well potential fluctuations. To that end we show that stimulated step-like Raman processes in the two-pulse excitation scheme allow us to probe the electron spin ensemble with high selectivity and precision even for systems with broad optical transitions. Next, Rabi oscillations for exciton complexes with different degree of localization are detected by photon echo spectroscopy. We observe that an increase of the area of either the first or the second pulse leads to a significant decrease of the photon echo signal, which is strongest for the neutral excitons and less pronounced for the donor-bound exciton complex.