We have developed an algorithm for the automatic detection of prospective unexploded ordnance (UXO) anomalies in total-field or gradient magnetic data based on the concept of the structural index (SI) of a magnetic anomaly. Identifying magnetic anomalies having specific structural indices enables the direct detection of potential UXO targets. The total magnetic field produced by a dipolelike source, such as a UXO, decays with inverse distance cubed and therefore has an SI of three, whereas the gradient data have an SI of four. The developed extended Euler deconvolution method based on the Hilbert transform provides a reliable means for calculating the spatial location, depth, and SI of compact and isolated anomalies; it has enabled us to perform automatic anomaly selection for further analysis. Our method first examines the anomaly decay and selects possible UXO anomalies based on the expected SI. We refine the result further by post-Euler amplitude analysis using the relative source strength of the anomalies selected in the first stage. The amplitude analysis statistically identifies weak anomalies that are due to noise in the data. This enhances the final result and eliminates automatic picks that fall within the noise level. We have demonstrated the effectiveness of the method using synthetic and field data sets.