High-carbon–chromium martensitic stainless steel (MSS) is widely used in many fields due to its excellent mechanical properties, while the coarse eutectic carbide in MSS deteriorates corrosion resistance. In this work, nitrogen was added to the MSS to improve corrosion resistance. The effects of nitrogen on the microstructure and corrosion resistance of MSS were systematically studied. The results showed that the addition of nitrogen promoted the development of Cr2N and reversed austenite, effectively inhibiting the formation of δ-ferrite. Therefore, the durability of the passivation film was improved, the passivation zone was expanded, and the susceptibility to metastable pitting was decreased. As a consequence, nearly two orders of magnitude have been achieved in the pitting potential (Epit) of MSS containing nitrogen, and the polarization resistance value (Rp) has gone up from 4.05 kΩ·cm2 to 1.24 × 102 kΩ·cm2. This means that in a corrosive environment, nitrogen-treated MSS stainless steel is less likely to form pitting pits, which further extends the service life of the material.