Context : Aims : We present a new measurement of the cosmic X-ray background ( CXRB ) in the 1.5-7 keV energy band , performed by exploiting the Swift X-ray telescope ( XRT ) data archive . We also present a CXRB spectral model in a wider energy band ( 1.5-200 keV ) , obtained by combining these data with the recently published Swift-BAT measurement . Methods : From the XRT archive we collect a complete sample of 126 high Galactic latitude gamma-ray burst ( GRB ) follow-up observations . This provides a total exposure of 7.5 Ms and a sky-coverage of \sim 7 square degrees which represents a serendipitous survey , well suited for a direct measurement of the CXRB in the 1.5-10 keV interval . Our work is based on a complete characterization of the instrumental background and an accurate measurement of the stray-light contamination and vignetting calibration . Results : We find that the CXRB spectrum in the 1.5-7 keV energy band can be equally well fitted by a single power-law with photon index \Gamma =1.47 \pm 0.07 or a single power-law with photon index \Gamma =1.41 \pm 0.06 and an exponential roll-off at 41 keV . The measured flux in the 2-10 keV energy band is 2.18 \pm 0.13 \times 10 ^ { -11 } erg cm ^ { -2 } s ^ { -1 } deg ^ { -2 } in the 2-10 keV band . Combining Swift-XRT with Swift-BAT ( 15-200 keV ) we find that , in the 1.5-200 keV band , the CXRB spectrum can be well described by two smoothly-joined power laws with the energy break at 29.0 \pm 0.5 keV corresponding to a \nu F _ { \nu } peak located at 22.4 \pm 0.4 keV . Conclusions : Taking advantage of both the Swift high energy instruments ( XRT and BAT ) , we produce an analytical description of the CXRB spectrum over a wide ( 1.5-200 keV ) energy band . This model is marginally consistent with the HEAO1 measurement ( \sim 10 % higher ) at energies higher than 20 keV , while it is significantly ( 30 % ) higher at low energies ( 2-10 keV ) .