We prove the optimal convergence of a discontinuous-Galerkin-based immersed boundary method introduced earlier [Lew and Buscaglia, Int. J. Numer. Methods Eng.76 (2008) 427–454]. By switching to a discontinuous Galerkin discretization near the boundary, this method overcomes the suboptimal convergence rate that may arise in immersed boundary methods when strongly imposing essential boundary conditions. We consider a model Poisson's problem with homogeneous boundary conditions over two-dimensional C 2-domains. For solution in Hq for q > 2, we prove that the method constructed with polynomials of degree one on each element approximates the function and its gradient with optimal orders h 2 and h, respectively. When q = 2, we have h 2-ε and h 1-ε for any ϵ > 0 instead. To this end,we construct a new interpolant that takes advantage of the discontinuities in the space, since standard interpolation estimates lead here to suboptimal approximation rates. The interpolation error estimate is based on proving an analog to Deny-Lions' lemma for discontinuous interpolants on a patch formed by the reference elements of any element and its three face-sharing neighbors. Consistency errors arising due to differences between the exact and the approximate domains are treated using Hardy's inequality together with more standard results on Sobolev functions.