Jupiter and Saturn exhibit similar large-scale dynamical features. Each planet has a prograde equatorial jet and a deeply seated dipolar magnetic field. Compared to Jupiter, Saturn's jet is broader and faster, while its magnetic field is weaker and more axially symmetric. The Sun also has prograde equatorial flow and a large-scale axial magnetic field. While the depth of the Sun's differential rotation is well constrained by helioseismology, the depth to which the zonal winds penetrate in the giant planets is not known and has been a subject of debate. Although magnetic braking has been invoked as the mechanism to slow the winds at depth, such a mechanism has not previously been demonstrated. Here we present the first self-consistent numerical planetary dynamo models in which slow convection in the interior dynamo source region coexists with strong zonal flow near the outer surface. The models include radially variable electrical conductivity and show that prograde zonal flow penetrates to a depth where Lorentz forces balance the Reynolds stress, which drives the equatorial jet. Our results imply that major differences between the surface zonal flows of Jupiter and Saturn arise from the different depths and conditions of a transition layer analogous to the solar tachocline. This transition layer, the planetary tachocline, separates the high velocity, semiconducting molecular envelope from the slow moving liquid metal interior dynamo.