Goal-directed navigation is thought to rely on the activity of head-direction cells, but how this activity guides moment-to-moment actions remains poorly understood. Here we characterize how heading neurons in the Drosophila central complex guide moment-to-moment navigational behavior. We establish an innate, heading-neuron-dependent, tethered navigational behavior where walking flies maintain a straight trajectory along a specific angular bearing for hundreds of body lengths. While flies perform this task, we use chemogenetics to transiently rotate their neural heading estimate and observe that the flies slow down and turn in a direction that aims to return the heading estimate to the angle it occupied before stimulation. These results support a working model in which the fly brain quantitatively compares an internal estimate of current heading with an internal goal heading and uses the sign and magnitude of the difference to determine which way to turn, how hard to turn and how fast to walk forward.