jaxspec performs statistical inference on X-ray spectra. It loads an X-ray spectrum (in the OGIP standard), defines a spectral model from the implemented components, and calculates the best parameters using state-of-the-art Bayesian approaches. The code is built on top of JAX (ascl:2111.002) to provide just-in-time compilation and automatic differentiation of the spectral models, enabling the use of sampling algorithms. jaxspec is written in pure Python and is not dependent on HEASoft (ascl:1408.004).