From Jech's Set Theory:
Proof. The uniqueness follows from Lemma 2.7. Given a well-ordered set $W$, we find an isomorphic ordinal as follows: Define $F(x) = \alpha$ if $\alpha$ is isomorphic to the initial segment of $W$ given by $x$. If such an $\alpha$ exists, then it is unique. By the Replacement Axioms, $ F(W) $ is a set. For each $x \in W$, such an $\alpha$ exists (otherwise consider the least $x$ for which such an $\alpha$ does not exist)...
How do we reach a contradiction by assuming there is a least $x$ for which such $\alpha$ does not exists?