Analyzing coordination environments using X-ray absorption spectroscopy has broad applications ranging from solid-state physics to material chemistry. Here, we show that random forest models can identify the main coordination environment from K-edge Xray absorption near edge structure (XANES) with a high accuracy of 85.4% and all associated coordination environments with a high Jaccard score of 81.8% for 33 cation elements in oxides, significantly outperforming other machine learning (ML) models.In a departure from prior works, we used a robust description of the coordination environment as a distribution over 25 distinct coordination motifs with coordination numbers ranging from 1-12. The random forest models were trained on the world's largest database of ∼ 190, 000 computed K-edge XANES spectra. Furthermore, the random forest models can be applied to predict the coordination environment from experimental K-edge XANES with minimal loss in accuracy (82.1%) due to the use of data augmentation. A drop-out feature importance analysis highlights the key roles that the pre-edge and main-peak regions play in coordination environment identification, with the post-peak region becoming increasingly important at higher coordination numbers.This work provides a general strategy to identify the coordination environment from K-edge XANES across broad chemistries, paving the way for future advancements in the application of ML to spectroscopy.