We consider f(R,T) modified theories of gravity, where the gravitational Lagrangian is given by an arbitrary function of the Ricci scalar R and of the trace of the stress-energy tensor T. We obtain the gravitational field equations in the metric formalism, as well as the equations of motion for test particles, which follow from the covariant divergence of the stress-energy tensor. Generally, the gravitational field equations depend on the nature of the matter source. The field equations of several particular models, corresponding to some explicit forms of the function f(R,T), are also presented. An important case, which is analyzed in detail, is represented by scalar field models. We write down the action and briefly consider the cosmological implications of the \(f(R,T^{\phi})\) models, where \(T^{\phi}\) is the trace of the stress-energy tensor of a self-interacting scalar field. The equations of motion of the test particles are also obtained from a variational principle. The motion of massive test particles is non-geodesic, and takes place in the presence of an extra force orthogonal to the four-velocity. The Newtonian limit of the equation of motion is further analyzed. Finally, we provide a constraint on the magnitude of the extra-acceleration by analyzing the perihelion precession of the planet Mercury in the framework of the present model.