We present a method to approximate the solution mapping of parametric constrained optimization problems. The approximation, which is of the spectral finite element type, is represented as a linear combination of orthogonal polynomials. Its coefficients are determined by solving an appropriate finite-dimensional constrained optimization problem. We show that, under certain conditions, the latter problem is solvable because it is feasible for a sufficiently large degree of the polynomial approximation and has an objective function with bounded level sets. In addition, the solutions of the finite-dimensional problems converge for an increasing degree of the polynomials considered, provided that the solutions exhibit a sufficiently large and uniform degree of smoothness. Our approach solves, in the case of optimization problems with uncertain parameters, the most computationally intensive part of stochastic finite-element approaches. We demonstrate that our framework is applicable to parametric eigenvalue problems.