We study an inverse problem of recovering a spatially varying potential term in a one-dimensional time-fractional diffusion equation from the flux measurements taken at a single fixed time corresponding to a given set of input sources. The unique identifiability of the potential is shown for two cases, i.e. the flux at one end and the net flux, provided that the set of input sources forms a complete basis in L 2(0, 1). An algorithm of the quasi-Newton type is proposed for the efficient and accurate reconstruction of the coefficient from finite data, and the injectivity of the Jacobian is discussed. Numerical results for both exact and noisy data are presented. © 2012 IOP Publishing Ltd.