We introduce the notions of relative endoscopic data, transfer factors, and the fundamental lemma for certain symmetric spaces associated to unitary groups over a nonarchimedean field of characteristic zero. The main result is a proof of this fundamental lemma.For this, we prove descent results delicate enough to reduce this statement to the infinitesimal analogue, which we have previously established. Along the way, we show that p-adic symmetric spaces enjoy a notion of topological Jordan decomposition, which may be of independent interest, and prove a relative version of a lemma of Kazhdan that played a crucial role in the proof of the Langlands-Shelstad fundamental lemma.