In this research, Capparis spinosa oil was used as a feedstock for biodiesel production in the presence of NaOH/NaX as a nano heterogeneous catalyst. The NaOH/NaX catalyst was characterized by XRD, SEM, and BET analyses. The transesterification reaction was optimized through response surface methodology (RSM) based on the central composite design (CCD) of experiments. The effects of key variables of catalyst weight, methanol to oil molar ratio, and time on the reaction were studied, and a precise discussion about the impact of each process variable on the biodiesel yield was carried out. The highest biodiesel yield was 90.33% for the optimum reaction conditions that include a constant temperature of 60 °C, methanol to oil molar ratio of 6.7:1, catalyst weight of 2.3 wt%, and reaction time of 1.24 h. Furthermore, all physicochemical properties of the produced biodiesel were matched to the ASTM standard. Based on the obtained results, Capparis spinosa oil is a suitable source for biodiesel production.