The selection of the elementary analysis windows in continuous noise recordings for optimal estimation of the mean horizontal‐to‐vertical spectral ratio (HVSR) curve is generally performed by visual inspection of HVSR curves considered as functions of time. Starting from full‐length records, HVSR curves are determined in consecutive time windows of appropriate lengths. Time windows with HVSR curves that are anomalous on the basis of a simple visual inspection are generally ignored in the computation of the average HVSR curve. It is often very difficult to optimize the selection of time windows to be used for the calculation of the HVSR curve representative of a site. The use of nonobjective selection criteria produces results which depend on personal opinions of the operator and for which reliability cannot be assessed with quantitative parameters. We implemented an automatic procedure, based on cluster analysis, for the determination of the optimal window subset for the computation of the average HVSR curve. The procedure is based on the application of the agglomerative hierarchical clustering, using a measure of proximity of the standard correlation between HVSR curves and, as a rule for merging clusters, the average linking criterion. The procedure has been applied to 814 measures of seismic noise, carried out for the first‐level microzonation of 20 municipalities of Eastern Sicily characterized by high seismic hazard. A critical comparison of the results obtained by the clustering procedure implemented with those previously obtained by processing the same recordings with a technique based on the visual comparison of the spectral ratios of all the analysis windows has shown that the automatic clustering procedure seems to be capable of achieving a better partitioning of a set of HVSR curves and thus provides effective help in the process of distinguishing between peaks mainly linked to the site effects and others mainly related to the source effects.