A measurement of top quark pairs produced in association with a W or Z boson is presented, using 19.5 fb-1 of proton-proton collisions with a center-of-mass energy of 8 TeV, collected by the CMS experiment at the LHC. Novel event reconstruction techniques are used to identify ttW and ttZ events with a high degree of confidence. The ttW cross section is measured to be 382+117−102 fb, yielding evidence for ttW production with a significance of 4.8 standard deviations from the background-only hypothesis. The ttZ process is observed for the first time, with a significance of 6.4 σ, and a measured cross section of 242+65−55 fb. The ttZ measurement is consistent with the standard model prediction, while the measured ttW cross section is higher than expected, but compatible with the standard model.