We study the optimal sets Ω ∗ ⊂ R d for spectral functionals F ( λ1(Ω),..., λp(Ω) ), which are bi-Lipschitz with respect to each of the eigenvalues λ1(Ω),..., λp(Ω) of the Dirichlet Laplacian on Ω, a prototype being the problem min { λ1(Ω) + · · · + λp(Ω) : Ω ⊂ R d, |Ω | = 1}. We prove the Lipschitz regularity of the eigenfunctions u1,..., up of the Dirichlet Laplacian on the optimal set Ω ∗ and, as a corollary, we deduce that Ω ∗ is open. For functionals depending only on a generic subset of the spectrum, as for example λk(Ω) or λk1 (Ω) + · · · + λkp (Ω) , our result proves only the existence of a Lipschitz continuous eigenfunction in correspondence to each of the eigenvalues involved.