There are strong demands today to further improve the thermal efficiency of internal combustion engines against a backdrop of various environmental issues, including rising carbon dioxide (CO2) emissions and global warming. One factor that impedes efforts to improve the thermal efficiency of spark ignition engines is the occurrence of knocking.The aim of this study was to elucidate the details of knocking based on spectroscopic measurements and visualization of phenomena in the combustion chamber of a test engine that was operated on three primary reference fuels with different octane ratings (0 RON, 30 RON, and 50 RON). The ignition timing was retarded in the experiments to delay the progress of flame propagation, making it easier to capture the behavior of low-temperature oxidation reactions at the time knocking occurred. Spectroscopic measurements were made at the light emission wavelength and transmitted light wavelength corresponding to those of formaldehyde (HCHO) produced as an intermediate product during a cool flame. Measurements were also made at the light emission wavelength of the OH radical that plays an important role in combustion. In addition, the effects of the progress of flame propagation and low-temperature oxidation reactions on the occurrence of knocking were investigated by obtaining the in-cylinder visualization simultaneously with the spectroscopic measurements at the transmitted light wavelength corresponding to that of HCHO.The results of the spectroscopic measurements made at the light emission and absorption wavelengths of HCHO showed that it was possible to detect cool flame reactions in the unburnt gas. Other behavior that was also captured simultaneously included the production of HCHO concurrent with the occurrence of a cool flame and its consumption concurrent with the occurrence of autoignition.