Controllable doping of two-dimensional materials is highly desired for ideal device performance in both hetero- and p-n homojunctions. Herein, we propose an effective strategy for doping of MoS2 with nitrogen through a remote N2 plasma surface treatment. By monitoring the surface chemistry of MoS2 upon N2 plasma exposure using in situ X-ray photoelectron spectroscopy, we identified the presence of covalently bonded nitrogen in MoS2, where substitution of the chalcogen sulfur by nitrogen is determined as the doping mechanism. Furthermore, the electrical characterization demonstrates that p-type doping of MoS2 is achieved by nitrogen doping, which is in agreement with theoretical predictions. Notably, we found that the presence of nitrogen can induce compressive strain in the MoS2 structure, which represents the first evidence of strain induced by substitutional doping in a transition metal dichalcogenide material. Finally, our first principle calculations support the experimental demonstration of such strain, and a correlation between nitrogen doping concentration and compressive strain in MoS2 is elucidated.