In this paper a numerical method for solving a class of fractional optimal control problems is presented which is based on Bernstein polynomials approximation. Operational matrices of integration, differentiation, dual and product are introduced and are utilized to reduce the problem of solving a system of algebraic equations. The method in general is easy to implement and yields good results. Illustrative examples are included to demonstrate the validity and applicability of the new technique.