In this paper, we consider a reaction-diffusion problem with an unknown nonlinear source function that has to be determined from overposed data. The underlying model is in the form of a time-fractional reaction-diffusion equation and the work generalizes some known results for the inverse problems posed for PDEs of parabolic type. For the inverse problem under consideration, a uniqueness result is proved and a numerical algorithm with some theoretical qualification is presented in the one-dimensional case. The key both to the uniqueness result and to the numerical algorithm relies on the maximum principle which has recently been shown to hold for the fractional diffusion equation. In order to show the effectiveness of the proposed method, results of numerical simulations are presented. © 2013 IOP Publishing Ltd.