Ab initio electronic structure theory has achieved considerable reliability concerning predictions of physical and chemical properties and phenomena. It provides understanding of matter at the atomic and electronic scale with an unprecedented level of details and accuracy. In the present contribution, the electronic structure theory and state-of-the-art ab initio calculation methods in solids are briefly reviewed and the application of the calculated total energy differences between various phases (lattice stabilities) is illustrated on construction of phase diagrams by the CALPHAD (CALculation of PHAse Diagrams) method in systems containing phases with complex structures, as e.g. Laves phases or sigma phase. Particular examples include description of the Laves phases in the Cr-Nb, Cr-Ta and Cr-Zr systems, sigma-phase in the Fe-Cr system and prediction of the phase composition of ternary Fe-Cr-Mo system and super-austenitic steels. It is shown that the utilization of ab initio results introduces a solid basis of the energetics of systems with complex phases, allows to avoid unreliable estimates and extrapolations of Gibbs energies and brings more physics into the CALPHAD method.