The time-dependent CP asymmetry in B0s → J=ψKþK− decays is measured using pp collision data, corresponding to an integrated luminosity of 3.0 fb−1, collected with the LHCb detector at center-of-mass energies of 7 and 8 TeV. In a sample of 96 000 B0 s → J=ψKþK− decays, the CP-violating phase ϕs is measured, as well as the decay widths ΓL and ΓH of the light and heavy mass eigenstates of the B0s–B¯ 0s system. The values obtained are ϕs¼−0.0580.0490.006rad, Γs≡ðΓLþΓHÞ=2¼0.66030.00270.0015ps−1, and Γs≡ΓL−ΓH¼0.08050.00910.0032ps−1, where the first uncertainty is statistical and the second, systematic. These are the most precise single measurements of those quantities to date. A combined analysis with B0 s → J=ψπþπ− decays gives ϕs ¼ −0.010 0.039 rad. All measurements are in agreement with the standard model predictions. For the first time, the phase ϕs is measured independently for each polarization state of the KþK− system and shows no evidence for polarization dependence.