We consider first-passage percolation with positive, stationary-ergodic weights on the square lattice Zd. Let T(x) be the first-passage time from the origin to a point x in Zd. The convergence of the scaled first-passage time T([nx])/n to the time-constant as n→∞ can be viewed as a problem of homogenization for a discrete Hamilton-Jacobi-Bellman (HJB) equation. We derive an exact variational formula for the time-constant, and construct an explicit iteration that produces a minimizer of the variational formula (under a symmetry assumption). We explicitly identify when the iteration produces correctors.