On the instantaneous spectrum of gamma-ray bursts