We address the problem of finding the closest matrix $$\tilde{\varvec{U}}$$ to a given $$\varvec{U}$$ under the constraint that a prescribed second-moment matrix $$\tilde{\varvec{P}}$$ must be matched, i.e. $$\tilde{\varvec{U}}^{\mathrm {T}}\tilde{\varvec{U}}=\tilde{\varvec{P}}$$ . We obtain a closed-form formula for the unique global optimizer $$\tilde{\varvec{U}}$$ for the full-rank case, that is related to $$\varvec{U}$$ by an SPD (symmetric positive definite) linear transform. This result is generalized to rank-deficient cases as well as to infinite dimensions. We highlight the geometric intuition behind the theory and study the problem’s rich connections to minimum congruence transform, generalized polar decomposition, optimal transport, and rank-deficient data assimilation. In the special case of $$\tilde{\varvec{P}}=\varvec{I}$$ , minimum-correction second-moment matching reduces to the well-studied optimal orthonormalization problem. We investigate the general strategies for numerically computing the optimizer and analyze existing polar decomposition and matrix square root algorithms. We modify and stabilize two Newton iterations previously deemed unstable for computing the matrix square root, such that they can now be used to efficiently compute both the orthogonal polar factor and the SPD square root. We then verify the higher performance of the various new algorithms using benchmark cases with randomly generated matrices. Lastly, we complete two applications for the stochastic Lorenz-96 dynamical system in a chaotic regime. In reduced subspace tracking using dynamically orthogonal equations, we maintain the numerical orthonormality and continuity of time-varying base vectors. In ensemble square root filtering for data assimilation, the prior samples are transformed into posterior ones by matching the covariance given by the Kalman update while also minimizing the corrections to the prior samples.