Transverse-momentum ($p_{\rm T}$) differential yields of electrons from semileptonic heavy-flavour hadron decays have been measured in the most central (0-10%) and in semi-central (20-40%) Pb-Pb collisions at $\sqrt{s_{\rm NN}} = 2.76$ TeV. The corresponding production cross section in pp collisions has been measured at the same energy with substantially reduced systematic uncertainties with respect to previously published results. The modification of the yield in Pb-Pb collisions with respect to the expectation from an incoherent superposition of nucleon-nucleon collisions is quantified at mid-rapidity ($|y|$ $<$ 0.8) in the $p_{\rm T}$ interval 0.5-3 GeV/$c$ via the nuclear modification factor, $R_{\rm AA}$. This paper extends the $p_{\rm...