Spin chains are paradigmatic systems for the studies of quantum phases and phase transitions, and for quantum information applications, including quantum computation and short-distance quantum communication. Here we propose and analyse a scheme for conditional state transfer in a Heisenberg XXZ spin chain which realizes a quantum spin transistor. In our scheme, the absence or presence of a control spin excitation in the central gate part of the spin chain results in either perfect transfer of an arbitrary state of a target spin between the weakly coupled input and output ports, or its complete blockade at the input port. We also discuss a possible proof-of-concept realization of the corresponding spin chain with a one-dimensional ensemble of cold atoms with strong contact interactions. Our scheme is generally applicable to various implementations of tunable spin chains, and it paves the way for the realization of integrated quantum logic elements.