Simulations of coupled electronic and nuclear dynamics in molecules can be quite challenging due to the involved interplay of the many degrees of freedom. Because a full quantum treatment of both electrons and nuclei is computationally very demanding, it is generally restricted to model systems or rather small molecules and short timescales. Mixed quantum-classical dynamics methods such as Tully's fewest switches surface hopping (FSSH) can be used to overcome this limitation. However, FSSH is known to poorly describe electronic coherences and decoherence phenomena. Here, we present an approach that combines FSSH with ring-polymer molecular dynamics (RPMD) in a specific way that aims to alleviate the coherence problem. Termed the ring-polymer-surface-hopping–density-matrix approach, this method uses an electronic density-matrix formulation to calculate surface hopping rates. This incorporates decoherence effects into FSSH in a natural way by taking into account the spatial spreading of the ring polymer that mimics the width of a nuclear wave packet in each RPMD trajectory. By applying our method to Tully's one-dimensional model system, we demonstrate that this method captures a crucial decoherence mechanism that is missing in FSSH. Furthermore, our method turns out to be superior at describing electronic coherences compared with earlier attempts at combining RPMD and FSSH.