Herein is reported a detailed study of the luminescence properties of nanostructured Si using X-ray excited optical luminescence (XEOL) in combination with X-ray absorption near-edge structures (XANES). P-type Si nanowires synthesized via electroless chemical etching from Si wafers of different doping levels and porous Si synthesized using electrochemical method are examined under X-ray excitation across the Si K-, L3,2-, and O K-edges. It is found that while as-prepared Si nanostructures are weak light emitters, intense visible luminescence is observed from thermally oxidized Si nanowires and porous Si. The luminescence mechanism of Si upon oxidation is investigated by oxidizing nanostructured Si at different temperatures. Interestingly, the two luminescence bands observed show different response with the variation of absorption coefficient upon Si and O core-electron excitation in elemental silicon and silicon oxide. A correlation between luminescence properties and electronic structures is thus established. The implications of the finding are discussed in terms of the behavior of the oxygen deficient center (OCD) and non-bridging oxygen hole center (NBOHC).