The first observation of the (tt) over barH process in a single Higgs boson decay channel with the full reconstruction of the final state (H -> gamma gamma) is presented, with a significance of 6.6 standard deviations (sigma). The CP structure of Higgs boson couplings to fermions is measured, resulting in an exclusion of the pure CP-odd structure of the top Yukawa coupling at 3.2 sigma. The measurements are based on a sample of protonproton collisions at a center-of-mass energy root s = 13 TeV collected by the CMS detector at the LHC, corresponding to an integrated luminosity of 137 fb(-1). The cross section times branching fraction of the (tt) over barH process is measured to be sigma B-(tt) over barH(gamma gamma) = 1.56(-0.32)(+0.34) th, which is compatible with the standard model prediction of 1.13(-0.11)(+0.08) fb. The fractional contribution of the CP-odd component is measured to be f(CP)(Hu) = 0.00 +/- 0.33.