The hydrogenation of HCN to methylamine on Co(111) was used as a model reaction to study the hydrogenation of nitriles to primary amines. Density functional theory was used to characterize the reaction mechanism, and the results obtained were compared with those for the same reaction on Ni(111). Hydrogen cyanide adsorbs more strongly on Co(111) than on Ni(111), with an adsorption energy of -1.72 eV. The hydrogenation product, methylamine, is weakly adsorbed on Co(111), with an adsorption energy of -0.53 eV, which is very similar to the adsorption energy calculated on Ni(111). The calculated adsorption energies were used to explain the differences in activity and selectivity observed between nickel- and cobalt-based catalysts; the stronger adsorption of HCN on cobalt explains both the lower activity and the higher selectivity observed on this metal. Regarding the reaction mechanism, the hydrogenation reaction implies an imine intermediate (H2CNH) independent of whether hydrogen reacts with the carbon atom or with the nitrogen atom of the hydrogen cyanide molecule in the first step. The imine intermediate subsequently reacts to form H3CNH, which is finally hydrogenated to yield methylamine. The overall surface reaction is endothermic. Remarkably, comparing the HCN hydrogenation reaction mechanism on Co(111) and Ni(111) revealed no significant differences.