Gradients of diffusible signaling proteins control precise spatial patterns of gene expression in the developing embryo. Here, we use quantitative expression measurements and thermodynamic modeling to uncover the cis-regulatory logic underlying spatially restricted gene expression in a Hedgehog (Hh) gradient in Drosophila. When Hh signaling is low, the Hh effector Gli, known as Cubitus interruptus (Ci) in Drosophila, acts as a transcriptional repressor; when Hh signaling is high, Gli acts as a transcriptional activator. Counterintuitively and in contrast to previous models of Gli-regulated gene expression, we found that low-affinity binding sites for Ci were required for proper spatial expression of the Hh target gene decapentaplegic (dpp) in regions of low Hh signal. Three low-affinity Ci sites enabled expression of dpp in response to low signal; increasing the affinity of these sites restricted dpp expression to regions of maximal signaling. A model incorporating cooperative repression by Ci correctly predicted the in vivo expression of a reporter gene controlled by a single Ci site. Our work clarifies how transcriptional activators and repressors, competing for common binding sites, can transmit positional information to the genome. It also provides an explanation for the widespread presence of conserved, nonconsensus Gli binding sites in Hh target genes.