An algorithm for the implementation of short-term prediction of traffic with real-time updating based on spectral analysis is described. The prediction is based on the characterization of the flow based on modal functions associated with a covariance matrix constructed from historical flow data. The number of these modal functions used for prediction depends on the local traffic characteristics. Although the method works well for the examples in this paper using the lower frequency modes, it can be adapted to include modes of higher frequency, as traffic conditions dictate. This paper describes the intended online implementation of the method that predicts within-day traffic flow using a forecasting horizon of 1 h 15 min with a 15-min step. Thus, every 15 min, the traffic flow for a further 1 h 15 min is predicted. As well as forecasting to this horizon, a second algorithm incorporating a weighted averaging technique is developed, which allows the prediction of one 15-min step ahead by using current and previous predictions of traffic flows at the given time instant while placing more weight on the more recent predictions. This technique combines the features of a time-series-based prediction with spectral analysis. The development of an algorithm for the real-time implementation is described, and results are presented for a number of different schemes. © 2011 IEEE.