A Shock Emission Model for Gamma-Ray Bursts. II. Spectral Properties