  We present a study of the superconducting transition in MgB2 using the
ab-initio pseudopotential density functional method and the fully anisotropic
Eliashberg equation. Our study shows that the anisotropic Eliashberg equation,
constructed with ab-initio calculated momentum-dependent electron-phonon
interaction and anharmonic phonon frequencies, yields an average
electron-phonon coupling constant lambda = 0.61, a transition temperature Tc =
39 K, and a boron isotope-effect exponent alphaB = 0.31 with a reasonable
assumption of mu* = 0.12. The calculated values for Tc, lambda, and alphaB are
in excellent agreement with transport, specific heat, and isotope effect
measurements respectively. The individual values of the electron-phonon
coupling lambda(k,k') on the various pieces of the Fermi surface however vary
from 0.1 to 2.5. The observed Tc is a result of both the raising effect of
anisotropy in the electron-phonon couplings and the lowering effect of
anharmonicity in the relevant phonon modes.
