We consider the following singularly perturbed problem epsilon(2)Delta u - u + f(u) = 0, u > 0 in Omega, partial derivative u/partial derivative v = 0 on partial derivative Omega. Existence of a solution with a spike layer near a min-max critical point of the mean curvature on the boundary partial derivative Omega is well known when a nondegeneracy for a limiting problem holds. In this paper, we use a variational method for the construction of such a solution which does not depend on the nondengeneracy for the limiting problem. By a purely variational approach, we construct the solution for an optimal class of nonlinearities f satisfying the Berestycki-Lions conditions.