The nuclear agreement between world powers and Iran is the product of two separate diplomatic tracks, one top secret and the other widely publicized—a risky gambit spearheaded by the White House that nearly derailed the talks.

For nearly five years, the White House drove a back-channel effort, personally overseen by President Barack Obama, which directly engaged Tehran and was concealed from Washington's closest allies and even some...