The purpose of this paper is to propose a computational method for the approximate solution of linear and nonlinear two-point boundary value problems. In order to approximate the solution, the expansions in terms of the Bernstein polynomial basis have been used. The properties of the Bernstein polynomial basis and the corresponding operational matrices of integration and product are utilized to reduce the given boundary value problem to a system of algebraic equations for the unknown expansion coefficients of the solution. On this approach, the problem can be solved as a system of algebraic equations. By considering a special case of the problem, an error analysis is given for the approximate solution obtained by the present method. At last, five examples are examined in order to illustrate the efficiency of the proposed method.