We carry out a systematic study of entanglement entropy in relativistic quantum field theory. This is defined as the von Neumann entropy S_A=-Tr rho_A log rho_A corresponding to the reduced density matrix rho_A of a subsystem A. For the case of a 1+1-dimensional critical system, whose continuum limit is a conformal field theory with central charge c, we re-derive the result S_A\sim(c/3) log(l) of Holzhey et al. when A is a finite interval of length l in an infinite system, and extend it to many other cases: finite systems,finite temperatures, and when A consists of an arbitrary number of disjoint intervals. For such a system away from its critical point, when the correlation length \xi is large but finite, we show that S_A\sim{\cal A}(c/6)\log\xi, where \cal A is the number of boundary points of A. These results are verified for a free massive field theory, which is also used to confirm a scaling ansatz for the case of finite-size off-critical systems, and for integrable lattice models, such as the Ising and XXZ models, which are solvable by corner transfer matrix methods. Finally the free-field results are extended to higher dimensions, and used to motivate a scaling form for the singular part of the entanglement entropy near a quantum phase transition.