The invention provides a terahertz spectrum analyzer which comprises a laser, three optical fiber couplers which are a first optical fiber coupler, a third optical fiber coupler and a fourth optical fiber coupler, an optical switch, a frequency shift ring, three optical delay lines which are a second optical delay line, a third optical delay line and a fourth optical delay line, a photoelectric detector, two photoelectric converters with terahertz detection antennas, two terahertz focusing elements and a terahertz optical splitter. In the acceleration of a terahertz electric field, photon-generated carriers are in accelerated motion to generate current which is proportional to the electric field amplitude of a terahertz wave, current is measured respectively, then square and sum are calculated, the radiation power of the terahertz wave is obtained, the frequency of the terahertz wave is obtained from the time sequence of the current, and the spectrum of the terahertz wave can be obtained. The terahertz spectrum analyzer has the advantages of wide spectral range, high spectral resolution and important scientific significance and application value and works at a room temperature.