Toughness, besides hardness, is one of the most important properties of wear-resistant coatings. We use ab initio density-functional theory calculations to investigate the mechanical properties of ternary metal nitrides Ti x M 1−x N, with M = Mo and W, for x = 0.5. Results show that Mo and W alloying significantly enhances the toughness of TiN. The electronic mechanism responsible for this improvement, as revealed by electronic structure calculations, stems from the changes in charge density induced by the additional transition-metal atom. This leads to the formation of a layered electronic arrangement, characterized by strong, respectively, weak, directional bonding, which enables a selective response to strain, respectively, shear, deformations of the structures and yields up to 60% decrease in C 44 values.