A least-squares solution is any $\hat x$ minimizing $\|Ax-b\|_2$ over all domain vectors. Equivalently, it solves the normal equations $A^*A\hat x=A^*b$. If the original system is consistent, least-squares residual is zero and its minimizers are exactly the exact solutions.