We model the acceleration of electrons at a shock front in a relativistic blazar jet and compute the radiation they emit in a post-shock region which contains a homogeneous magnetic field. The full space, time and momentum dependence of the electron distribution is used in this calculation. It is shown that the ` homogeneous'\ synchrotron model is recovered, provided the downstream speed of the plasma away from the shock front is nonrelativistic, and provided that the light travel times across the face of the shock front is unimportant. By varying the rate at which particles are picked up by the acceleration process, we calculate the time-dependence of the spectra. Since the magnetic field strength is assumed constant within the emission region, each frequency band can be identified with electrons of a particular energy. We find that for a band in which the electrons are accelerated rapidly compared to the rate at which they cool, the spectra typically harden during phases of rising flux, and soften during phases of falling flux, as has been observed in the objects PKS 2155-304 and Mkn 421. However, in a frequency band in which the timescales are comparable, the reverse behaviour is to be expected. We discuss the extent to which observations of both the stationary spectrum and the spectral variability of the synchrotron component of blazar emission can be used to constrain the model.