The coordination and local structure of Si and Al in silicate glasses and melts have been studied using Si and Al K-edge X-ray absorption spectroscopy for the first time. It has been verified that in SiO2-P2O5 and Na2O-SiO2-P2O5 join phosphate silicate glasses, Si atoms remains tetrahedrally coordinated with oxygen when the content of P2O5 is below 32 mol%, but partial Si atoms become octahedrally coordinated with oxygen when the content of P2O5 increases above 32 mol%, and the proportion of the octahedrally coordinated Si atoms increases with the increasing content of P2O5. It has also been demonstrated that Al remains four-fold coordinated with oxygen in ambient NaAlSi2O6-NaAlSi3O8 glasses, but in the same composition glasses quenched at 4.4 GPa and 1,575 degrees C, partial Al atoms becomes five- and six-fold coordinated with oxygen, and at the same pressure and temperature, the proportions of five- and six-fold coordinated Al atoms increases with the increasing content of NaAlSi2O6 in the glasses. Thus, the pressure-induced coordination change of Al in aluminosilicate glasses and melts has been observed for the first time by Al K-edge X-ray absorption spectroscopy.