W–S–N self-lubricant coatings were deposited by d.c. reactive magnetron sputtering at two total discharge pressures of 0.6 and 1.2Pa. The nitrogen content and S/W ratio varied from 0 to 30at.%, and 0.6 to 1.6, respectively. The effect of deposition conditions on chemical composition, structure and mechanical properties was studied; coatings with the most promising properties have been selected for tribological testing. Coatings were nanostructured with nanograins of tungsten disulfide; the size of which decreased with increasing nitrogen content. Hardness increased with N content up to 7GPa for coating deposited with a discharge pressure of 1.2Pa; coatings deposited at lower pressure exhibited hardness around 9GPa. Friction and wear behavior in humid air and dry nitrogen was evaluated using a pin-on-disk tribometer. The wear tracks and the ball wear scars were analyzed by Raman spectroscopy and scanning electron microscopy. Although the friction coefficient in dry nitrogen was significantly lower than in humid air, the wear rate was similar for both environments. Detailed wear track surface analysis showed that the tribolayer formed on the surface contained mostly tungsten disulfide and tungsten oxide.