Understanding the surface structure of a catalyst under a reaction environment is challenging, yet necessary. Now, a combination of in situ methods reveals the reversible formation of a surface alloy as the active phase for core–shell Ni–Au nanoparticles during CO2 hydrogenation, which could not be detected by ex situ methods.