The operating principle of a Pt thin-film H2 gas sensor was investigated using a combination of surface sensitive ambient-pressure X-ray photoelectron spectroscopy and bulk sensitive X-ray absorption fine structure techniques, which provided chemical and structure information under working conditions, coupled with electric resistivity measurements. It is shown that the sensor response was in a linear relation with both coverages of H and O atoms on the Pt surface. Moreover, the bulk structure of Pt remains unchanged under H2 exposure. These observations support that the resistivity change is associated with electron scattering in the near-surface region.