We present an analysis of the nearby electromagnetic fields generated by lightning discharges in the presence of a horizontally stratified, two-layer ground. To the best of our knowledge, this is the first time the effect of ground stratification on underground fields generated by lightning is analyzed. The analysis is performed by solving Maxwell's equations using the finite-difference time-domain technique. The return stroke channel is modeled using the modified transmission line model with exponential decay. The effect of the soil stratification on both above-ground fields and the fields penetrating into the ground is illustrated and discussed for two different cases characterized, respectively, by an upper layer more conductive than the lower level, and vice versa. The analysis was carried out for close distances (10 m-100 m from the channel). It is shown that, for these distances, the ground stratification does not significantly affect the electromagnetic fields above the ground. The above-ground vertical electric field and the azimuthal component of the magnetic field can be calculated assuming the ground as a perfectly conducting plane. The above-ground horizontal electric field is essentially determined by the characteristics of the conductive layer and it can be computed considering a homogeneous ground characterized by the conductive layer conductivity as long as the depth of the upper layer remains below 10 m or so. In general, the fields penetrating into the ground are markedly affected by the soil stratification. The electromagnetic field components inside the stratified soil are generally characterized by faster rise times compared to those of the field components in the case of a homogeneous ground with the upper layer characteristics. The peak value of the horizontal electric field is found to be very sensitive to the ground stratification. The horizontal electric field peak decreases considerably in the presence of a lower layer of higher conductivity. On the other hand, the presence of a lower layer with lower conductivity results in an increase of the peak value of the underground horizontal electric field.