The S-wave velocity of the shallow subsurface can be inferred from shallow-seismic Rayleigh waves. Traditionally, the dispersion curves of the Rayleigh waves are inverted to obtain the (local) S-wave velocity as a function of depth. Two-dimensional elastic full-waveform inversion (FWI) has the potential to also infer lateral variations. We have developed a novel workflow for the application of 2D elastic FWI to recorded surface waves. During the preprocessing, we apply a line-source simulation (spreading correction) and perform an a priori estimation of the attenuation of waves. The iterative multiscale 2D elastic FWI workflow consists of the preconditioning of the gradients in the vicinity of the sources and a source-wavelet correction. The misfit is defined by the least-squares norm of normalized wavefields. We apply our workflow to a field data set that has been acquired on a predominantly depth-dependent velocity structure, and we compare the reconstructed S-wave velocity model with the result obtained by a 1D inversion based on wavefield spectra (Fourier-Bessel expansion coefficients). The 2D S-wave velocity model obtained by FWI shows an overall depth dependency that agrees well with the 1D inversion result. Both models can explain the main characteristics of the recorded seismograms. The small lateral variations in S-wave velocity introduced by FWI additionally explain the lateral changes of the recorded Rayleigh waves. The comparison thus verifies the applicability of our 2D FWI workflow and confirms the potential of FWI to reconstruct shallow small-scale lateral changes of S-wave velocity.