In this work, gasochromic pristine and Mo-modified V2O5 thin films were prepared by the sol-gel spin coating method. Both films exhibit excellent gasochromic coloration. Synchrotron grazing incidence X-ray diffraction reveals that the Mo-modified V2O5 thin film is more amorphous than the pristine V2O5 thin film. X-ray absorption spectroscopy (XAS) was utilized to elucidate the modifications of the local electronic and atomic structures that are caused by Mo. In situ soft-XAS and in situ hard-XAS were performed to monitor the effect of the adsorption of dihydrogen on the charge state of vanadium and local atomic rearrangement in the gasochromic thin films. The gasochromic V2O5 film has a significantly pyramid-like oxygen-coordinated environment. However, the Mo-modified film exhibits mixed pyramid- and octahedral-like structures. Analytic results indicate that upon gasochromic coloration, adsorption of hydrogen adds electrons to the V 3d t2g orbital, lowering the charge state of vanadium. The films undergo structural modification before the valence is changed. The Mo-modified V2O5 film exhibits faster coloration because the apical V-O bond differs from that in the pristine V2O5 film. This in situ XAS allows real-time monitoring of changes in the element-specific local atomic structure during the gasochromic reaction and enables the elucidation of the gasochromic mechanism.