The top quark pair production cross section is measured in proton-proton collisions at a center-of-mass energy of 5.02 TeV. The data were collected in a special LHC low-energy and low-intensity run in 2017, and correspond to an integrated luminosity of 302 pb−1. The measurement is performed using events with one electron and one muon of opposite charge, and at least two jets. The measured cross section is 60.7 ± 5.0 (stat) ± 2.8 (syst) ± 1.1 (lumi) pb. A combination with the result in the single lepton + jets channel, based on data collected in 2015 at the same center-of-mass energy and corresponding to an integrated luminosity of 27.4 pb−1, is then performed. The resulting measured value is 63.0 ± 4.1 (stat) ± 3.0 (syst+lumi) pb, in agreement with the standard model prediction of 66.8−3.1+2.9 pb. [Figure not available: see fulltext.].