In this paper we propose a numerical solution of a fractional oscillator equation (being a class of the fractional Euler–Lagrange equation). At first, we convert the fractional differential equation of order α>0 to an equivalent integral equation (including boundary conditions). Next, we present a numerical solution of the integral form of the considered equation for two cases: α∈(0,1] and α∈(1,2]. We show illustrative examples of solutions for checking the correctness of the proposed solution method of the equation. Also, we determine the convergence order of numerical schemas.