In order to improve the lubrication performance of the WS2-based coatings at elevated temperature, the mechanisms of enhancing the tribological performance of WSNb coatings at elevated temperatures are investigated. The WSNb coating doped with 11.9 at.% Nb exhibited excellent anti-friction and wear resistance, achieved a low coefficient of friction of 0.02 at 400 °C, and its wear resistance was much better than that of WS2-based coatings. The Nb metal and its sulfide in the coating are more sensitive to oxygen than WS2 at 400 °C, which reduces the oxygen concentration between the friction pairs and protects the WS2 lubricating phase from being oxided. In addition, Nb enhances the hardness and Young's modulus of the coatings through the solid solution strengthening effect, generating a more continuous and stable lubricating film during the silding process. First-principles calculation results demonstrated that the Nb spontaneously forms Nb-S bonds with S atoms in the coating. The molecular details of the Nb-S formation have been investigated in depth.