We present FLEXWIN, an open source algorithm for the automated selection of time windows on pairs of observed and synthetic seismograms. The algorithm was designed specifically to accommodate synthetic seismograms produced from 3-D wavefield simulations, which capture complex phases that do not necessarily exist in 1-D simulations or traditional traveltime curves. Relying on signal processing tools and several user-tuned parameters, the algorithm is able to include these new phases and to maximize the number of measurements made on each seismic record, while avoiding seismic noise. Our motivation is to use the algorithm for iterative tomographic inversions, in which the synthetic seismograms change from one iteration to the next. Hence, automation is needed to handle the volume of measurements and to allow for an increasing number of windows at each model iteration. The algorithm is sufficiently flexible to be adapted to many tomographic applications and seismological scenarios, including those based on synthetics generated from 1-D models. We illustrate the algorithm using data sets from three distinct regions: the entire globe, the Japan subduction zone, and southern California.