We introduce a max-plus analogue of the Petrov-Galerkin finite element method, to solve finite horizon deterministic optimal control problems. The method relies on a max-plus variational formulation, and exploits the properties of projectors on max-plus semimodules. We obtain a nonlinear discretized semigroup, corresponding to a zero-sum two players game. We give an error estimate of order \((\Delta t)^{1/2}+\Delta x(\Delta t)^{-1}\), for a subclass of problems in dimension 1. We compare our method with a max-plus based discretization method previously introduced by Fleming and McEneaney.