We report a measurement of the mass difference between neutral charm-meson eigenstates using a novel approach that enhances sensitivity to this parameter. We use 2.3×106 D0→KS0π+π- decays reconstructed in proton-proton collisions collected by the LHCb experiment in 2011 and 2012. Allowing for CP violation in mixing and in the interference between mixing and decay, we measure the CP-averaged normalized mass difference xCP=[2.7±1.6(stat)±0.4(syst)]×10-3 and the CP-violating parameter Δx=[-0.53±0.70(stat)±0.22(syst)]×10-3. The results are consistent with CP symmetry. These determinations are the most precise from a single experiment and, combined with current world-average results, yield the first evidence that the masses of the neutral charm-meson eigenstates differ.