Direct and mixing-induced CP -violating asymmetries in B 0 s → K + K − decays are measured for the first time using a data sample of pp collisions, corresponding to an integrated luminosity of 1.0 fb −1 , collected with the LHCb detector at a centre-of-mass energy of 7 TeV. The results are C KK = 0.14 ± 0.11 ± 0.03 and S KK = 0.30 ± 0.12 ± 0.04, where the first uncertainties are statistical and the second systematic. The corresponding quantities are also determined for B 0 → π + π − decays to be C ππ = −0.38 ± 0.15 ± 0.02 and S ππ = −0.71 ± 0.13 ± 0.02, in good agreement with existing measurements.