We present a technique for the computation of the Green's tensor in three-d
imensional stratified media composed of an arbitrary number of layers with
different permittivities and permeabilities (including metals with a comple
x permittivity). The practical implementation of this technique is discusse
d in detail. In particular, we show how to efficiently handle the singulari
ties occurring in Sommerfeld integrals, by deforming the integration path i
n the complex plane. Examples assess the accuracy of this approach and illu
strate the physical properties of the Green's tensor, which represents the
field radiated by three orthogonal dipoles embedded in the multilayered med
ium.