Abstract: Central exclusive and semiexclusive production of ?+?? pairs is measured with the CMS detector in protonproton collisions at the LHC at center-of-mass energies of 5.02 and 13 TeV. The theoretical description of these nonperturbative processes, which have not yet been measured in detail at the LHC, poses a significant challenge to models. The two pions are measured and identified in the CMS silicon tracker based on specific energy loss, whereas the absence of other particles is ensured by calorimeter information. The total and differential cross sections of exclusive and semiexclusive central ?+?? production are measured as functions of invariant mass, transverse momentum, and rapidity of the ?+?? system in the fiducial region defined as transverse momentum pT(?) > 0.2GeV and pseudorapidity |?(?)| < 2.4. The production cross sections for the four resonant channels f0(500), ?0 (770), f0(980), and f2(1270) are extracted using a simple model. These results represent the first measurement of this process at the LHC collision energies of 5.02 and 13 TeV.