Abstract. A group-theoretic version of Dehn surgery is studied. Starting with an arbitrary relatively hyperbolic group G we define a peripheral filling procedure, which produces quotients of G by imitating the effect of the Dehn filling of a complete finite-volume hyperbolic 3-manifold M on the fundamental group π 1 (M ). The main result of the paper is an algebraic counterpart of Thurston's hyperbolic Dehn surgery theorem. We also show that peripheral subgroups of G "almost" have the Congruence Extension Property and the group G is approximated (in an algebraic sense) by its quotients obtained by peripheral fillings.