We investigate the self-phase modulation (SPM) of a single-cycle terahertz pulse in a semiconductor, using bulk n-GaAs as a model system. The SPM arises from the heating of free electrons in the electric field of the terahertz pulse, leading to an ultrafast reduction of the plasma frequency, and hence to a strong modification of the terahertz-range dielectric function of the material. Terahertz SPM is observed directly in the time domain. In the frequency domain it corresponds to a strong frequency-dependent refractive index nonlinearity of n-GaAs, found to be both positive and negative within the broad spectrum of the terahertz pulse, with the zero-nonlinearity point defined by the electron momentum relaxation rate. We also observed the nonlinear spectral broadening and compression of the terahertz pulse.