The thermodynamic properties of the Zr-Nb alloy are investigated at temperatures below 890 K with ab initio calculations. The solution energies of the bcc Nb-rich and hcp Zr-rich solid solutions obtained within the framework of density functional theory are in good agreement with experimental data, although insufficient for a quantitative description of the miscibility gap, for which non configurational entropy has to be accounted for. Whereas electronic free energies can be neglected, we show, using the harmonic approximation and the density functional perturbation theory, that both solution free energies are strongly modified by the contribution related to atomic vibrations. Considering this vibrational free energy leads to a good description of the phase diagram.