We propose a new spectral method, based on two classes of hat functions, for solving systems of fractional differential equations. The fractional derivative is considered in the Caputo sense. Properties of the basis functions, Caputo derivatives and Riemann–Liouville fractional integrals, are used to reduce the main problem to a system of nonlinear algebraic equations. By analyzing in detail the resulting system, we show that the method needs few computational efforts. Two test problems are considered to illustrate the efficiency and accuracy of the proposed method. Finally, an application to a recent mathematical model in epidemiology is given, precisely to a system of fractional differential equations modeling the respiratory syncytial virus infection.