Muller's ratchet describes the irreversible accumulation of deleterious mutations in asexual populations. In well-mixed populations the speed of fitness decline is exponentially small in the population size, and any positive rate of beneficial mutations is sufficient to reverse the ratchet in large populations. The behavior is fundamentally different in populations with spatial structure, because the speed of the ratchet remains nonzero in the infinite size limit when the deleterious mutation rate exceeds a critical value. Based on the relation between the spatial ratchet and directed percolation, we develop a scaling theory incorporating both deleterious and beneficial mutations. The theory is verified by extensive simulations in one and two dimensions.