The top quark pair production cross section (ad) is measured for the first time in pp collisions at a center-of-mass energy of 5.02 TeV. The data were collected by the CMS experiment at the LHC and correspond to an integrated luminosity of 27.4 pb(-1). The measurement is performed by analyzing events with at least one charged lepton. The measured cross section is sigma(tt) = 69.5 +/- 6.1 (stat) +/- 5.6 (syst) +/- 1.6 (lumi) pb, with a total relative uncertainty of 12%. The result is in agreement with the expectation from the standard model. The impact of the presented measurement on the determination of the gluon distribution function is investigated.