The template‐matching algorithm (TMA) has become an important tool for detecting small and/or unconventional earthquakes, and newly detected seismic events have improved our understanding of earthquake physics, regional tectonics, and geological hazards. Standard TMA‐based detection methods do not take into account the fact that the template waveforms themselves are contaminated with noise. In this study, we propose a weighted template‐matching algorithm (WTMA), in which the normalized cross‐correlation time series are weighted according to the signal‐to‐noise ratios of the corresponding template waveforms before they are being stacked for event picking. We present results from an extensive collection of numerical experiments to demonstrate that WTMA is capable of improving the detection rate of small to tiny (e.g., ) earthquakes while reducing the computational cost associated with the standard TMA‐based detection methods. The application of our WTMA to the continuous waveform recordings before the 6.4 earthquake in the 2019 Ridgecrest sequence allowed us to discover foreshocks, a larger number than the foreshocks detected using the standard TMA, and significantly larger than the 17 foreshocks documented in the Southern California Seismic Network (SCSN) catalog. Relocated hypocenters of the foreshocks suggest a complex faulting pattern that is consistent with the hierarchical interlocked orthogonal faulting that characterized the main Ridgecrest sequence. Magnitudes of the foreshocks obtained through careful waveform amplitude calibration provided a more robust estimate of the magnitude–frequency distribution, which reduced the minimum magnitude threshold and increased the ‐value, as compared with those obtained from the SCSN catalog.