Let Ω⊂R be a compact measurable set of measure 1 and with null boundary measure. We show that if Ω is a spectral set, then it admits a rational spectrum. The proof relies on the periodicity of spectrums shown in [16], and adopts the technique in [28] for analyzing zeros of exponential sums as well as the technique in [16] that relates the spectrum to the tiling of |1ˆΩ|2. The key technical ingredient we contribute that eventually leads to the result is the periodicity of values from an exponential sum on a certain subgroup of Z, which characterizes the torsion part of the spectrum. An immediate consequence of this result, together with periodicity and rationality results in [16,28], is the equivalence between the Fuglede conjecture in R and in Zn.