A measurement of the cross section for top quark-antiquark ( tt¯) pairs produced in association with a photon in proton-proton collisions at √s =8 TeV is presented. The analysis uses data collected with the CMS detector at the LHC, corresponding to an integrated luminosity of 19.7 fb1. The signal is defined as the production of a tt¯ pair in association with a photon having a transverse energy larger than 25 GeV and an absolute pseudorapidity smaller than 1.44. The measurement is performed in the fiducial phase space corresponding to the semileptonic decay chain of the tt¯ pair, and the cross section is measured relative to the inclusive tt¯ pair production cross section. The fiducial cross section for associated tt¯ pair and photon production is found to be 127 ±27 (stat+syst) fb per semileptonic final state. The measured value is in agreement with the theoretical prediction.