Detection of fundamental and harmonic components is important to the control, protection, and compensation applications of grid-connected converters for the power-quality purposes. The conventional frequency-domain methods often suffer from the problems of at least one-cycle delay and dependence on frequency resolution. On the other hand, the numerical stability and robustness to interference are the necessary factors in the time-domain methods. To resolve the aforementioned issues, an adaptive model-based scheme with short sliding analysis window is proposed to track the frequency deviation and modify the analysis model with the online-sampled data to extract time-varying harmonics. Through the synchronized detection and accurate extraction of harmonics, the performance of proposed technique can be verified with several field measurement cases.