Structural phase transitions and superconducting properties in three phases ͑9R, fcc, and cI16͒ of solid Li are investigated using a pseudopotential plane-wave method based on density functional perturbation theory. In particular, it is shown that phonon softening is responsible for a pressure-induced fcc→ cI16 transition as well as for a significant enhancement of electron-phonon coupling and superconducting transition temperature T c preceding this structural transformation. The nature of superconductivity in the fcc and cI16 phases is examined by solving the Eliashberg equations with the spectral function ␣ 2 F͑͒ obtained from first-principles calculations and by evaluating the functional derivative ␦T c / ␦␣ 2 F͑͒. The calculated T c reaches a maximum at pressure close to the fcc→ cI16 transition and is significantly reduced in the cI16 phase, in agreement with the trend observed experimentally. The variation in T c as a function of pressure is explained in terms of the functional derivative and shifts of the spectral weight.