In order to attack the problem of industrial interference in magnetotellurics, we apply the general theory of Weidelt and Christensen describing the electromagnetic fields of a grounded electric dipole over a horizontally stratified earth. The impedance tensor for dipole fields is proven to be independent of the dipole orientation. Within the near field, the elements of the impedance tensor are real quantities, and are independent of period. Because of this, the logarithm of the apparent resistivity versus the logarithm of period rises with a slope of 45 degrees and the phase is zero. We study the inversion of the controlled-source impedance tensor to reveal earth structure at a given distance from the source, using a nonlinear least-squares technique. We present an interpretation of magnetotelluric data in the Tangshan area of China as a practical application of the technique. Sedimentary thicknesses of about 600 m are estimated and agree well with conventional Schlumberger soundings. The upper resistive crust (thickness about 13 km) overlies a more conductive lower crust whose resistivity is below a few hundred Omega . m.