Estimation in time series with an unknown number of deterministic trigonometric components with unknown amplitudes and frequencies is considered. A stepwise procedure is used. At each step the frequency of the largest term in the periodogram of the residual series is used as a starting value for finding the best frequency in the least squares sense. The procedure is stopped when there are no further significant harmonic components, when tested by a multiple-test procedure. The fitting procedure is tried on various time series, including the sun-spot series. For long-term prediction the deterministic model does better for the sunspot series than, for example, autoregressive models.