The direct energy functional minimization problem in electronic structure theory, where the single-particle orbitals are optimized under the constraint of orthogonality, is explored. We present an orbital transformation based on an efficient expansion of the inverse factorization of the overlap matrix that keeps orbitals orthonormal. The orbital transformation maps the orthogonality constrained energy functional to an approximate unconstrained functional, which is correct to some order in a neighborhood of an orthogonal but approximate solution. A conjugate gradient scheme can then be used to find the ground state orbitals from the minimization of a sequence of transformed unconstrained electronic energy functionals. The technique provides an efficient, robust, and numerically stable approach to direct total energy minimization in first principles electronic structure theory based on tight-binding, Hartree-Fock, or density functional theory. For sparse problems, where both the orbitals and the effective single-particle Hamiltonians have sparse matrix representations, the effort scales linearly with the number of basis functions N in each iteration. For problems where only the overlap and Hamiltonian matrices are sparse the computational cost scales as O(M2N), where M is the number of occupied orbitals. We report a single point density functional energy calculation of a DNA decamer hydrated with 4003 water molecules under periodic boundary conditions. The DNA fragment containing a cis-syn thymine dimer is composed of 634 atoms and the whole system contains a total of 12,661 atoms and 103,333 spherical Gaussian basis functions.