The direct metalation of tetraphenylporphyrin with bare metal atoms (Co and Zn) was studied with X-ray photoelectron spectroscopy, scanning tunneling microscopy, and temperature-programmed reaction measurements on ordered monolayer films of the molecules adsorbed on a Ag(111) surface. The mechanism of this novel type of surface reaction was investigated using density functional theory (DFT) calculations for the related gas-phase reactions of the unsubstituted porphyrin with the metals Fe, Co, Ni, Cu, and Zn. The reaction starts with the formation of an initial complex, in which the metal atom is coordinated by the intact unreduced porphyrin. This complex resembles the sitting-atop complex proposed for porphyrin metalation with metal ions in solution. In two subsequent steps, the pyrrolic hydrogen atoms are transferred to the metal atom, forming H2, which is eventually released. The activation barriers of the H-transfer steps vary for the different metal atoms. DFT calculations suggest that metalations with Fe, Co, and Ni show two-state reactivity, while those with Cu and Zn proceed on a single potential energy surface. For metalation with Zn, we calculated a barrier of the first hydrogen transfer step of 32.6 kcal mol-1, in good agreement with the overall experimental activation energy of 31 kcal mol-1.