BackgroundVarious surface-enhanced Raman spectroscopy (SERS) substrate preparation methods have been reported, however, how to tune the “gap” between nanostructures to make more “hot spots” is still a barrier that restricts their application. The gap between nanostructures is usually fixed when the substrates are prepared. In other words, it is hard to tune interparticle distances for maximum electromagnetic coupling during substrate preparation process. Therefore, an in-situ substrate optimization method that could monitor the SERS signal intensity changes, i.e., to find the optimum gap width and particle size, during substrate preparation process is needed. ResultsA method based on the galvanic replacement reaction (GRR) is proposed for the in-situ gap width tuning between nanostructures as well as for the optimization of SERS substrates. Noble metal nanoparticles (NPs) form and grow on the sacrificial templates' surface while noble metal ions are reduced by sacrificial metal (oxides) in GRR. Along with the fresh and clean NPs’ surface generated, the gap between two noble metal NPs decreases with the growth of the NPs. To demonstrate this strategy, cuprous oxide/Ti (Cu2O/Ti) sacrificial templates were prepared, and then a GRR was carried out with HAuCl4. The real-time SERS detection during GRR show that the optimum reaction time (ORT) is 300 ± 30 s. Furthermore, SERS performance testing was conducted on the optimized substrate, revealing that the detection limit for crystal violet can reach 1.96 × 10−11 M, confirming the feasibility of this method. Significance and noveltyBy monitoring the in-situ SERS signal of probes during GRR will obtain an “optimal state” of the SERS substrate with optimal gap width and particle size. The SERS substrate preparation and optimization strategy proposed in this article not only provides a simple, efficient, and low-cost method to fabricate surface-clean noble NPs but also paves the way for the in-situ optimization of NPs size and gap width between NPs which could achieve wider applications of SERS.