We present a technique for the solution of the complex-valued eigenproblem associated with the propagation of surface waves in general linear viscoelastic media. The new technique permits simultaneous determination of the Rayleigh dispersion and attenuation curves and the displacement and stress eigenfunctions for vertically heterogeneous, linear viscoelastic media with arbitrary values of material damping ratio. The technique is based on the Cauchy residue theorem of complex analysis that takes full advantage of the holomorphic properties of the Rayleigh secular function, which is viewed as an analytic mapping of the complex-valued Rayleigh phase velocity. Because the eigenvalue problem is solved directly in the complex domain with no simplifying assumptions, the algorithm implicitly accounts for the inherent coupling between phase velocity and attenuation of seismic waves as a result of material dispersion. The technique overcomes the limitations of previous algorithms that often break up the complex structure of the problem and/or require a priori information about the number of eigenvalues and their approximate value. The algorithm is validated via comparisons with closed-form solutions for a uniform half-space. Examples are also used to compare solutions obtained with the proposed technique and one based on the assumption of weak dissipation in strongly and weakly dissipative layered media.