Using ab initio molecular-dynamics simulations combined with linear-response theory, we calculate the density and temperature dependence of the x-ray absorption near-edge structure ͑XANES͒ of a dense aluminum plasma. At solid density and for temperatures increasing up to 6 eV, we see that the XANES spectrum loses its well-known room-temperature structure, first due to melting and second due to loss of correlation in the liquid. Similarly, as the density decreases and the system evolves from a liquid to a plasma, the XANES spectrum becomes less structured. As the density is further lowered and the system turns into an atomic fluid, a pre-edge forms as the 3p state becomes bound. We suggest that direct measurements of the XANES spectra in this density region is a unique opportunity to validate pressure ionization models routinely used in plasma physics modeling.The prospect of extending the characterization of dense plasmas and shock compressed matter to near-edge absorption spectroscopy is very appealing both from the theoretical and the experimental sides. X-ray absorption near-edge structure ͑XANES͒ refers to the spectral region lying about 40 eV above the absorption edge. X-ray absorption spectroscopy is widely used, for example, in chemistry to identify oxidation degree or in catalysis to identify the geometry of substitution sites. In these situations, the detailed analysis of the XANES spectra brings invaluable information on the electronic structure as well as on the local geometry. Measurements of near-edge absorption spectra of shock compressed matter would potentially bring invaluable information on the evolution of the electronic structure as the system is subject to a significant increase in both pressure and temperature. This was first realized by Bradley et al. 1 who performed K-edge measurements on shocked chlorine. A significant redshift of the edge was also observed for shock compressed aluminum. 2,3 From the theoretical side, several attempts have been made to combine electronic structure calculations with plasma models of varying degree of sophistication to provide a description of the near-edge absorption spectra or K-edge photoionization position. 4-6 All these models suffer, however, from an inconsistency between the two treatments as these calculations make use of various assumptions to model the electronic or the ionic structures. These two quantities are difficult to obtain, especially in the dense plasma regime where a self-consistent description of the ionic and electronic structures is needed. It is especially true when electron localization-delocalization and/or details of the ionic structure play an important role as, for example, in the nonmetalmetal transition observed, among other systems, in hydrogen, 7 helium, 8 or aluminum. 9 The use of an ab initio electronic structure approach based on density-functional theory combined with molecular-dynamics simulations and linear-response theory has been rather successful at providing, to first order, a satisfying description of this comple...