An experimental study of a nanosecond pulsed regime in a THz gyrotron oscillator operating in a self-consistent Q-switch regime has been carried out. The gyrotron is operated in the TE7,2 transverse mode radiating at a frequency of 260.5 GHz. The 5 W nanosecond pulses are obtained in a self-consistent Q-switch regime in which the cavity diffraction quality factor dynamically varies by nearly 2 orders of magnitude on a subnanosecond time scale via the nonlinear interaction of different mode-locked frequency-equidistant sidebands. The experimental results are in good agreement with numerical simulations performed with the TWANG code based on a slow time scale formulation of the self-consistent time-dependent nonlinear wave particle interaction equations.