Using first principles, I formulate surface-consistent deconvolution as a problem in optimization, to which I apply methods for nonlinear least-squares. To minimize processing artifacts, I avoid data transformations such as Fourier transforms or slant stacks. My deconvolution filters are computed as approximate solutions to a large, sparse, least-squares system. Useful solutions are obtained in a few iterations, with each iteration equivalent in cost to performing a single-trace deconvolution of the data.The use of optimization removes a great deal of uncertainty about the results of surface-consistent deconvolution. If, with a given choice of filter length, etc., a good deconvolution can be obtained, it is obtained. I illustrate the method and its limitations with three instructive field examples. The first underlines the issues of uncertainty and reliability. The other two show how surface-consistent deconvolution can degrade as seismic data depart from the surface-consistent model by small and large amounts, respectively.