In this article, we present a method to simulate wave propagation in a 2D medium with an irregular free surface by using a finite-difference method. The free-surface conditions are developed through an explicit scheme in displacement. In our technique, a conventional grid is used to define the zone where there is material and the zone where there is not material. In this method a fictitious line of material above the free surface is used to compute the displacement at the free surface. A classification of the points that shape the fictitious line is presented. Then displacements in the internal points of the material are computed together with the displacements at the points of the free surface, and subsequently the displacement at the points of the fictitious line are updated applying the boundary conditions by using an explicit finite-difference scheme. We present some results of the application of this technique by means of the simulation of the seismic response of a canyon and a mountain using an explosive source and a vertical force, respectively. We compared the results with the synthetics calculated by the indirect boundary element method (ibem). First, we tested the method simulating the wave propagation at a half-space with a planar surface. The comparison with the results of the ibem gave us confidence to deal with other models with topography features. These topographical models provided results that were in very good agreement with the results obtained by the ibem.