SUMMARY Intermediate-depth earthquakes, accommodating intraslab deformation, typically occur within subduction zone settings at depths between 60–300 km. These events are in a unique position to inform us about the geodynamics of the subducting slab, specifically the geometry of the slab and the stress state of the host material. Improvements in the density and quality of recorded seismic data enhance our ability to determine precise locations of intermediate-depth earthquakes, in order to establish connections between event nucleation and the tectonic setting. Depth phases (near-source surface reflections, e.g. pP and sP) are crucial for the accurate determination of earthquake source depth using global seismic data. However, they suffer from poor signal-to-noise ratios in the P wave coda. This reduces the ability to systematically measure differential traveltimes to the direct P arrival, particularly for the frequent lower magnitude seismicity which highlights considerable seismogenic regions of the subducted slabs. To address this limitation, we have developed an automated approach to group globally distributed stations at teleseismic distances into ad-hoc arrays with apertures of 2.5$^\circ$, before optimizing and applying phase-weighted beamforming techniques to each array. Resultant vespagrams allow automated picking algorithms to determine differential arrival times between the depth phases and their corresponding direct P arrival. Using these differential times we can then determine the depths of earthquakes, which in turn can be used to create a catalogue of relocated events. This will allow new comparisons and insights into the governing controls on the distribution of earthquakes in subducted slabs. We demonstrate this method by relocating intermediate-depth events associated with northern Chile and the Peruvian flat slab regions of the subducting Nazca plate. The relocated Chilean catalogue contains comparable event depths to an established catalogue, calculated using a semi-automated global methodology, which serves to validate our fully automatic methodology. The new Peruvian catalogue we generate indicates three broad zones of seismicity approximately between latitudes 1–7$^\circ$S, 7–13$^\circ$S and 13–19$^\circ$S. These align with flat to steep slab dip transitions and the previously identified Pucallpa Nest. We also find a regionally deeper slab top than indicated by recent slab models, with intraslab events concentrated at points where the slab bends, suggesting a link between slab flexure and intermediate-depth earthquake nucleation.