The energy spectrum and energy transfer in compressible homogeneous turbulent shear flow are numerically investigated via high-accuracy direct numerical simulation. The Helmholtz decomposition method is employed to decompose the velocity field into a solenoidal component and a compressive one. It is found that the spectra of different velocity modes are strongly anisotropic over all the resolved scales and the specific properties of small-scale anisotropy are significantly influenced by the flow compressibility. The anisotropy of energy transfer process comes from an additional kinetic energy production term which acts as a dominant source at relatively large scales in the streamwise direction. After the redistribution of turbulent kinetic energy caused by the pressure-dilatation correlation in different directions, the energy fluxes due to advection are also expected to be anisotropic. The streamwise energy flux is predominantly large and passes down the kinetic energy to smaller scales, whereas the cross streamwise and spanwise energy fluxes are less significant and pronounce an inverse energy transfer at relatively large scales.