The internal phase profile of electromagnetic radiation determines many functional properties of metal, oxide or semiconductor heterostructures. In magnetic heterostructures, emerging spin electronic phenomena depend strongly upon the phase profile of the magnetic fieldH at gigahertz frequencies. Here we demonstrate nanometre-scale, layer-resolved detection of electromagnetic phase through the radio frequency magnetic fieldH rf in magnetic heterostructures. Time-resolved X-ray magnetic circular dichroism reveals the local phase of the radio frequency magnetic field acting on individual magnetizationsM i through the susceptibility asM ¼wH rf . An unexpectedly large phase variation, B40°, is detected across spinvalve trilayers driven at 3 GHz. The results have implications for the identification of novel effects in spintronics and suggest general possibilities for electromagnetic-phase profile measurement in heterostructures.