This paper concerns a first-order algorithmic technique for a class of optimal control problems defined on switched-mode hybrid systems. The salient feature of the algorithm is that it avoids the computation of Frechet or G^ateaux derivatives of the cost functional, which can be time consuming, but rather moves in a projected-gradient direction that is easily computable (for a class of problems) and does not require any explicit derivatives. The algorithm is applicable to a class of problems where a pointwise minimizer of the Hamiltonian is computable by a simple formula, and this includes many problems that arise in theory and applications. The natural setting for the algorithm is the space of continuous-time relaxed controls, whose special structure renders the analysis simpler than the setting of ordinary controls. While the space of relaxed controls has theoretical advantages, its elements are abstract entities that may not be amenable to computation. Therefore, a key feature of the algorithm is that it computes adequate approximations to relaxed controls without loosing its theoretical convergence properties. Simulation results, including cpu times, support the theoretical developments.