A generalized Kohn-Sham (GKS) scheme which variationally minimizes the random phase approximation (RPA) ground state energy with respect to the GKS one-particle density matrix is introduced. We introduce the notion of functional-selfconsistent (FSC) schemes, which vary the oneparticle Kohn-Sham (KS) potential entering an explicitly potential-dependent exchange-correlation (XC) energy functional for a given density, and distinguish them from orbital-selfconsistent (OSC) schemes, which vary the density, or the orbitals, density matrix, or KS potential generating the density. It is shown that, for explicitly potential-dependent XC functionals, existing OSC schemes such as the optimized effective potential method violate the Hellmann-Feynman theorem for the density, producing a spurious discrepancy between the KS density and the correct Hellmann-Feynman density for approximate functionals. A functional selfconsistency condition is derived which resolves this discrepancy by requiring the XC energy to be stationary with respect to the KS potential at fixed density. We approximately impose functional selfconsistency by by semicanonical projection (sp) of the PBE KS Hamiltonian. Variational OSC minimization of the resulting GKS-spRPA energy functional leads to a nonlocal correlation potential whose off-diagonal blocks correspond to orbital rotation gradients, while its diagonal blocks are related to the RPA self-energy at real frequency. Quasiparticle GW energies are a first-order perturbative limit of the GKS-spRPA orbital energies; the lowest-order change of the total energy captures the renormalized singles excitation correction to RPA. GKS-spRPA orbital energies are found to approximate ionization potentials and fundamental gaps of atoms and molecules more accurately than semilocal density functional approximations (SL DFAs) or G0W0 and correct the spurious behavior of SL DFAs for negative ions. GKS-spRPA energy differences are uniformly more accurate than the SL-RPA ones; improvements are modest for covalent bonds but substantial for weakly bound systems. GKS-spRPA energy minimization also removes the spurious maximum in the SL-RPA potential energy curve of Be2, and produces a single Coulson-Fischer point at ∼ 2.7 times the equilibrium bond length in H2. GKS-spRPA thus corrects most density-driven errors of SL-RPA, enhances the accuracy of RPA energy differences for electron-pair conserving processes, and provides an intuitive one-electron GKS picture yielding ionization potentials energies and gaps of GW quality.