We prove a Lagrange multipliers theorem for a class of functions that are derivable along directions in a linear subspace of a Banach space where they are defined. Our result is available for topological linear vector spaces and is stronger than the classical one even for two-dimensional spaces, because we only require the differentiablity of functions at critical points. Applying these results we generalize the Lax-Milgram theorem. Some applications in variational inequalities and quasilinear elliptic equations are given.