A new method to measure the X-rays pulse duration through the analysis of the statistical properties of the SASE FEL spectra has been developed. The information on the pulse duration is contained in the correlation function of the intensity spectra measured after a spectrometer. The spectral correlation function is derived analytically for different profile shapes in the exponential growth regime and issues like spectral central frequency jitter and shot by shot statistical gain are addressed. Numerical simulations will show that the method is applicable also in saturation regime and that both pulse duration and spectrometer resolution can be recovered from the spectral correlation function. The method has been experimentally demonstrated at LCLS, measuring the soft X-rays pulse durations for different electron bunch lengths, and the evolution of the pulse durations for different undulator distances. Shorter pulse durations down to 13 fs FWHM have been measured using the slotted foil.