We propose and analyze 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 present a possible realization of the corresponding spin chain with a one-dimensional ensemble of cold atoms with strong contact interactions.