An appropriate well spacing plan is critical for the economic development of shale gas reservoirs. The biggest challenge for well spacing optimization is interpreting the subsurface uncertainties associated with hydraulic and natural fractures. Another challenge is the existence of complex natural fractures. This work applied an integrated well spacing optimization workflow in shale gas reservoirs of the Sichuan Basin in China with both hydraulic and natural fractures. The workflow consists of five components: data preparation, reservoir simulation, estimated ultimate recovery (EUR) analysis, economic calculation, and well spacing optimization. Firstly, the multiple realizations of thirteen uncertain parameters of matrix and fractures, including matrix permeability and porosity, three relative permeability parameters, hydraulic fracture height, half-length, width, conductivity, water saturation, and natural fracture number, length, and conductivity, were captured by the assisted history matching (AHM). The fractures were modeled by the embedded discrete fracture model (EDFM) accurately and efficiently. Then, 84 AHM solutions combining with five well spacing scenarios from 517 ft to 1550 ft would generate 420 simulation cases. After reservoir simulation of these 420 cases, we forecasted the long-term gas production for each well spacing scenario. Gas EUR degradation and well interference would imply the critical well spacing. The net present value (NPV) for all scenarios would be calculated and trained by
K
-nearest neighbors (KNN) proxy to better understand the relationship between well spacing and NPV. In this study, the optimum well spacing was determined as 793 ft, corresponding with a maximum NPV of 18 million USD, with the contribution of hydraulic fractures and natural fractures.