The Pt−Rh thin-film sensors exhibit excellent sensitivity and selectivity for H2 gas detection. Here, we studied the mechanism of highly selective detection of H2 by the Pt−Rh thin-film sensors with ambient-pressure X-ray photoelectron spectroscopy (AP−XPS) measurements at working conditions, which were paralleled with electric resistivity measurements. The elemental composition and chemical state of surface Pt and Rh drastically change depending on the background gas environments, which directly link to the sensor response. It is revealed that surface segregated Pt atoms accelerate dissociative adsorption of H2, resulting in a reduction of the sensor surface and then a decrease of electric resistivity of the film, whereas a thin oxidized Rh layer blocks dissociation of the other reducing agent, that is, NH3. This is supported from the adsorption energetics obtained by the density functional theory (DFT) calculations.