The Koopman Mode Decomposition (KMD) is a data-analysis technique which is often used to extract the spatio-temporal patterns of complex flows. In this paper, we use KMD to study the dynamics of the lid-driven flow in a two-dimensional square cavity based on theorems related to the spectral theory of the Koopman operator. We adapt two algorithms, from the classical Fourier and power spectral analysis, to compute the discrete and continuous spectrum of the Koopman operator for the post-transient flows. Properties of the Koopman operator spectrum are linked to the sequence of flow regimes occurring between Re = 10000 and Re = 30000, and changing the flow nature from steady to aperiodic. The Koopman eigenfunctions for different flow regimes, including flows with mixed spectra, are constructed using the assumption of ergodicity in the state space. The associated Koopman modes show remarkable robustness even as the temporal nature of the flow is changing substantially. We observe that KMD outperforms the proper orthogonal decomposition in reconstruction of the flows with strong quasi-periodic components.