Defect centers in diamond are exceptional solid-state quantum systems that can have exceedingly long electron and nuclear spin coherence times. So far, single-qubit gates for the nitrogen nuclear spin, a two-qubit gate with a nitrogen-vacancy (NV) center electron spin, and entanglement between nearby nitrogen nuclear spins have been demonstrated. Here, we develop a scheme to implement a universal two-qubit gate between two distant nitrogen nuclear spins. Virtual excitation of an NV center that is embedded in an optical cavity can scatter a laser photon into the cavity mode; we show that this process depends on the nuclear spin state of the nitrogen atom. If two NV centers are simultaneously coupled to a common cavity mode and individually excited, virtual cavity photon exchange can mediate an effective interaction between the nuclear spin qubits, conditioned on the spin state of both nuclei, which implements a universal controlled-
Z gate. We predict operation times below $10\phantom{\rule{0.16em}{0ex}}\ensuremath{\mu}\mathrm{s}$, which is four orders of magnitude faster than the decoherence time of nuclear spin qubits in diamond.
Quantum entanglement, a key resource for quantum information science, is inherent in a solid. It has been recently shown that entanglement between a single optical photon and a single spin qubit in a solid is generated via spontaneous emission. However, entanglement generation by measurement is rather essential for quantum operations. We here show that the physics behind the entangled emission can be time reversed to demonstrate entangled absorption mediated by an inherent spin-orbit entanglement in a single nitrogen vacancy center in diamond. Optical arbitrary spin state preparation and complete spin state tomography reveal the fidelity of the entangled absorption to be 95%. With the entangled emission and absorption of a photon, materials can be spontaneously entangled or swap their quantum state based on the quantum teleportation scheme.