X-Ray absorption fine structure (XAFS) spectroscopy has experienced a rapid development in the last four decades and has proved to be a powerful structure characterization technique in the study of local environments in condensed matter. In this article, we first introduce the XAFS basic principles including theory, data analysis and experiment in some detail. Then we attempt to make a review on the applications of XAFS to the study of atomic and electronic structure in dilute magnetic semiconductor (DMS) systems. The power of XAFS in characterizing this interesting material system, such as determining the occupation sites and distribution of the dopants, detecting the presence of metal clusters or secondary phases, as well as identifying the defect types and dopant valence, will be illuminated by selected examples. This review should be of interest both to newcomers in the DMS field and to an interdisciplinary community of researchers working in synthesis, characterization and utilization of DMS materials.