We study a model for corrosion and passivation of a metallic surface after small damage of its protective layer using scaling arguments and simulation. We focus on the transition between an initial regime of slow corrosion rate (pit nucleation) to a regime of rapid corrosion (propagation of the pit), which takes place at the so-called incubation time. The model is defined in a lattice in which the states of the sites represent the possible states of the metal (bulk, reactive, and passive) and the solution (neutral, acidic, or basic). Simple probabilistic rules describe passivation of the metal surface, dissolution of the passive layer, which is enhanced in acidic media, and spatially separated electrochemical reactions, which may create pH inhomogeneities in the solution. On the basis of a suitable matching of characteristic times of creation and annihilation of pH inhomogeneities in the solution, our scaling theory estimates the average radius of the dissolved region at the incubation time as a function of the model parameters. Among the main consequences, that radius decreases with the rate of spatially separated reactions and the rate of dissolution in acidic media, and it increases with the diffusion coefficient of H(+) and OH(-) ions in solution. The average incubation time can be written as the sum of a series of characteristic times for the slow dissolution in neutral media, until significant pH inhomogeneities are observed in the dissolved cavity. Despite having a more complex dependence on the model parameters, it is shown that the average incubation time linearly increases with the rate of dissolution in neutral media, under the reasonable assumption that this is the slowest rate of the process. Our theoretical predictions are expected to apply in realistic ranges of values of the model parameters. They are confirmed by numerical simulation in two-dimensional lattices, and the expected extension of the theory to three dimensions is discussed.