Fix a prime number $p$ and let $E/F$ be a CM extension of number fields in which $p$ splits relatively. Let $\pi $ be an automorphic representation of a quasi-split unitary group of even rank with respect to $E/F$ such that $\pi $ is ordinary above $p$ with respect to the Siegel parabolic subgroup. We construct the cyclotomic $p$ -adic $L$ -function of $\pi $ , and a certain generating series of Selmer classes of special cycles on Shimura varieties. We show, under some conditions, that if the vanishing order of the $p$ -adic $L$ -function is 1, then our generating series is modular and yields explicit nonzero classes (called Selmer theta lifts) in the Selmer group of the Galois representation of $E$ associated with $\pi $ ; in particular, the rank of this Selmer group is at least 1. In fact, we prove a precise formula relating the $p$ -adic heights of Selmer theta lifts to the derivative of the $p$ -adic $L$ -function. In parallel to Perrin-Riou’s $p$ -adic analogue of the Gross–Zagier formula, our formula is the $p$ -adic analogue of the arithmetic inner product formula recently established by Chao Li and the second author.