Effective functionalization of magnetic properties through substitutional doping may extend the spintronic applications of two-dimensional (2D) semiconductor MoS2. Here, the magnetoelectric properties of nitrogen-doped monolayer MoS2 are investigated by first-principles calculations, revealing that the N-p and S-p states are strongly hybridized with the Mo-d states, thus leading to the appearance of magnetism as verified experimentally. We demonstrate in situ doping of monolayer MoS2 with nitrogen via a convenient chemical vapor deposition method. Incorporation of nitrogen into MoS2, leading to the evolution of magnetism, is evidenced by combining x-ray photoelectron spectroscopy and vibrating sample magnetometer measurements. By comparison with pristine monolayer MoS2, the distinct ferromagnetism behaviors of nitrogen-doped monolayer MoS2 are observed up to room temperature, while the semiconducting nature persists. Our work introduces an efficient and feasible approach to realize magnetism in the 2D limit and explores potential applications in semiconductor spintronics.