The Wannier localization problem in quantum physics is mathematically analogous to finding a localized representation of a subspace corresponding to a nonlinear eigenvalue problem. While Wannier localization is well understood for insulating materials with isolated eigenvalues, less is known for metallic systems with entangled eigenvalues. Currently, the most widely used method for treating systems with entangled eigenvalues is to first obtain a reduced subspace (often referred to as disentanglement) and then to solve the Wannier localization problem by treating the reduced subspace as an isolated system. This is a multi-objective nonconvex optimization procedure and its solution can depend sensitively on the initial guess. We propose a new method to solve the Wannier localization problem, avoiding the explicit use of an an optimization procedure. Our method is robust, efficient, relies on few tunable parameters, and provides a unified framework for addressing problems with isolated and entangled eigenvalues.