We prove a relative version of Kontsevich's formality theorem. This theorem involves a manifold M and a submanifold C and reduces to Kontsevich's theorem if C=M. It states that the DGLA of multivector fields on an infinitesimal neighbourhood of C is L∞-quasiisomorphic to the DGLA of multidifferential operators acting on sections of the exterior algebra of the conormal bundle. Applications to the deformation quantisation of coisotropic submanifolds are given. The proof uses a duality transformation to reduce the theorem to a version of Kontsevich's theorem for supermanifolds, which we also discuss. In physical language, the result states that there is a duality between the Poisson sigma model on a manifold with a D-brane and the Poisson sigma model on a supermanifold without branes (or, more properly, with a brane which extends over the whole supermanifold).