The implementation of the Gob-Side Entry Retaining Mining Mode with Roof Cutting and Pressure Relief (GERRCPR) results in the gob connecting to the retaining roadway, creating an open space that causes significant air leakage and increases the risk of spontaneous combustion. A study was conducted during the implementation of the GERRCPR in the Xiaonan Coal Mine N1-1502 working face to investigate spontaneous combustion characteristics, along with fire prevention and extinguishing measures. To analyze gob airflow, Computational Fluid Dynamics (CFD) was employed to collect data on airflow conditions, O2 concentration, and temperature. Based on this, this study focuses on exploring the effects of nitrogen injection treatment under various rates and positions to optimize parameters for buried pipe nitrogen injection. Results indicated that within the GERRCPR, air leakage in the gob increased, leading to an increase in O2 concentration, expansion of the oxidation zone, and an elevated risk of spontaneous combustion. Air leakage primarily occurred from the retaining roadway and the working face near the intake-air roadway, peaking at a retaining roadway length of 500 m, with a flow rate of 226 m3/min. Following nitrogen injection treatment, the oxidation zone was significantly reduced, with optimal treatment achieved at a nitrogen injection depth of 70 m and a rate of 600 m3/h. Field monitoring data showed that the inertization measure of using porous long pipes, a nitrogen injection spacing of 30 m, and a nitrogen injection rate of 600 m3/h significantly decreased the O2 concentration within the gob. This reduction meets safety production requirements and outperforms the effectiveness of traditional buried-pipe nitrogen injection methods, thereby validating the simulation accuracy. Understanding the laws governing spontaneous coal combustion in the GERRCPR and enacting preventive measures for nitrogen injection can improve safety standards in mining operations. This proactive approach can effectively prevent spontaneous coal combustion accidents, resulting in substantial social benefits.