Super vast generalisation: for divisors on a smooth projective variety over an algebraically closed field of any characteristic, the notions of algebraic, homological (for any Weil cohomology theory), and numerical equivalence agree (up to torsion).
Remark. Recall: the group of cycles $\alpha \sim_{\text{alg}} 0$ is generated by cycles of the form
$$\pi_{1,*} (\pi_2^* ([t_1] - [t_2]))$$
for $C$ a curve, $t_1, t_2 \in C$, and $V \subseteq X \times C$ a subvariety flat over $C$, with projections $\pi_1 \colon V \to X$, $\pi_2 \colon V \to C$. To show that $\operatorname{cl}(\alpha) = 0$, one reduces to the case $[t_1] - [t_2]$ on a curve.
On the other hand, if $\operatorname{cl}(\alpha) = 0$, then compatibility between the intersection product and the cup product shows that $\alpha \sim_{\text{num}} 0$.
Lemma. If $D$ is a divisor with $D \sim_{\text{num}} 0$, then $nD \sim_{\text{alg}} 0$ for some $n \in \mathbb Z_{>0}$.
Remark. If $k = \mathbb C$ and we use singular cohomology, then we can actually say a little bit more:
- If $D \sim_{\text{num}} 0$, then $nD \sim_{\text{hom}} 0$ for some $n$,
- If $D \sim_{\text{hom}} 0$ (integrally), then $D \sim_{\text{alg}} 0$.
Fulton's Lemma 19.3.1 states both, but only proves the second assertion (it seems). I will prove both.
Remark. Since in general we don't have access to an integral Weil cohomology theory (the best we can do is $\mathbb Z_\ell$), there is no analogue of the second statement for other Weil cohomology theories.
Proof 1. (Over $k = \mathbb C$ for singular cohomology)
- Let $H$ be an ample class, and recall that $\operatorname{NS}(X)_\mathbb Q$ is the intersection $H^{1,1}(X) \cap H^2(X,\mathbb Q)$, by the Lefschetz $(1,1)$-theorem. By hard Lefschetz and Poincaré duality (and since $- \cup H$ is compatible with both the Hodge decomposition and the $\mathbb Q$-structure), the pairing
\begin{align*}
\operatorname{NS}(X)_\mathbb Q \times \operatorname{NS}(X)_\mathbb Q &\to H^{2n}(X,\mathbb Q) \cong \mathbb Q\\
(\alpha, \beta) &\mapsto \alpha \cup H^{n-2} \cup \beta
\end{align*}
is a perfect pairing. Hence, $\operatorname{cl}(D) = 0 \in H^2(X,\mathbb Q)$ if and only if $D \cdot C = 0$ for all curves $C$. (The summary is that hard Lefschetz and Lefschetz $(1,1)$ give us enough curves to cup with.)
We have the exact sequence
$$0 \to H^1(X, \mathbb Z) \to H^1(X, \mathcal O_X) \to \operatorname{Pic}(X) \to H^2(X,\mathbb Z) \to H^2(X,\mathcal O_X) \to \ldots.$$
The map $\operatorname{Pic}(X) \to H^2(X,\mathbb Z)$ is the Chern class map (which is the same thing as the cycle class map in this case). Thus, any element in the kernel will come from $H^1(X, \mathcal O_X)/H^1(X, \mathbb Z)$. But that's exactly the identity component $\operatorname{Pic}^0_{X/\mathbb C}$.
Write $D = D_1 - D_2$ as a difference of effective divisors. Then $D_1$ and $D_2$ live in the same component of $\operatorname{Pic}_{X/\mathbb C}$. Choose a curve connecting them. The universal family restricted to this curve is now a family of effective divisors from $D_1$ to $D_2$, showing that $D \sim_{\text{alg}} 0$. $\square$
Proof 2. (Over any (algebraically closed?) field for any Weil cohomology theory)
By Riemann–Roch, we have
$$\chi(X,\mathcal O(D)) = \int_X \operatorname{ch}(\mathcal O(D)) \cdot \operatorname{td}(T_X),$$
and similarly for $\mathcal O$. The point is that the right hand side is defined purely in terms of intrinsic geometry of $X$ and the intersection behaviour of $D$. Indeed, for a line bundle $\mathcal L$, we have
$$\operatorname{ch}(\mathcal L) = 1 + c_1(\mathcal L) + \frac{c_1(\mathcal L)^2}{2} + \ldots + \frac{c_1(\mathcal L)^n}{n!};$$
we cup it with some fixed thing $\operatorname{td}(T_X)$, and we integrate (i.e. take the degree of the component in dimension $0$). This only depends on the intersection behaviour of $c_1(\mathcal L)$. We conclude that
$$\chi(X,\mathcal O(D)) = \chi(X,\mathcal O),$$
since the intersections of $D$ and $0$ with any curve agree.
Edit: An argument is missing here; I thought I fixed it but that created a different gap. In order to deploy the theory of Quot schemes, we have to write $\mathcal O$ and $\mathcal O(D)$ as quotient of the same vector bundle. For this, some boundedness argument is needed. This is carried out in characteristic $0$ in Lazarsfeld's Positivity in Algebraic Geometry I, Prop 1.4.37 (using Fujita's vanishing theorem), or in general in FGA Explained, Lemma 9.6.6 (using a variant of Mumford's argument for boundedness of the Hilbert scheme, cf. Lectures on curves on an algebraic surface, Lecture 14, Theorem).
Now by the theory of Quot schemes, when we fix the Hilbert polynomial, the Quot scheme is projective. In particular, it has finitely many components, so a multiple of $\mathcal O(D)$ has to land in the identity component $\operatorname{Pic}^0_{X/k}$.
Now write $D = D_1 - D_2$ with $D_1, D_2$ effective; then $D_1$ and $D_2$ lie in the same component of the Picard scheme. Choosing a curve connecting these two points in $\operatorname{Pic}^0_{X/k}$ gives a family of effective divisors from $nD_1$ to $nD_2$, showing that $nD \sim_{\text{alg}} 0$. $\square$
Remark. If you want to see this Riemann–Roch thing in action: just look at the formula of the Euler characteristic of a line bundle on a surface. The point is that the formula only depends on certain intersection numbers; we don't even need to know which intersection numbers.
Remark. Why does this approach fail for higher codimension subvarieties? For instance, there are examples of irreducible subvarieties $Z_1, Z_2 \subseteq X$ that are numerically equivalent, but their Hilbert polynomials do not agree. In fact, you can even do this (exercise!) for smooth curves in $\mathbb P^3$, for which numerical equivalence coincides with algebraic (or even rational) equivalence!
(If you are confused about this last example, note that cycles are parametrised by Chow schemes, not Hilbert schemes. So the fact that algebraically equivalent subvarieties can have different Hilbert polynomials is not a contradiction.)
Although in this example the conclusion does hold, it shows that the method above cannot be generalised. Another reason is of course that the result $\sim_{\text{alg}} = \sim_{\text{num}}$ is not true in general. However, the equality $\sim_{\text{hom}, \mathbb Q} = \sim_{\text{num}}$ is not known; this is one of Grothendieck's standard conjectures on algebraic cycles.
Remark. In the first proof, we need that the complex torus $\operatorname{Pic}^0_{X/\mathbb C} = H^1(X,\mathcal O_X)/H^1(X,\mathbb Z)$ is actually algebraic when $X$ is smooth projective.
Proof 1 (analytic).
Recall that a complex torus $V/U$ is projective (hence algebraic) if and only if there is a positive definite hermitian metric $h$ on $V$ such that $\operatorname{im} h$ is integral on $U \times U$ (see for example Mumford's book on abelian varieties, p. 33).
To construct such a form for $V = H^1(X,\mathcal O_X)$ and $U = H^1(X,\mathbb Z)$, let $H$ be a hyperplane class, and set
\begin{align*}
h \colon V \times V &\to \mathbb C\\
(v,w) &\mapsto \frac{1}{4\pi^2 i} \cdot v \cup \bar w \cup H^{n-1}.
\end{align*}
Here, we view elements in $H^1(X,\mathcal O_X)$ as living in $H^1(X,\mathbb C) = H^1(X, \mathcal O_X) \oplus H^0(X,\Omega^1_{X/\mathbb C})$. Remember that $H^1(X,\mathbb Z)$ for our purposes maps to $H^1(X,\mathbb C)$ by multiplication by $2 \pi i$; this is different from the natural inclusion $H^1(X, \mathbb Z) \subseteq H^1(X, \mathbb C)$.
Note that
\begin{align*}
h(w,v) &= \frac{1}{4 \pi^2 i} \cdot w \cup \bar v \cup H^{n-1} \\
&= \frac{1}{4 \pi^2 i} \cdot (-1) \cdot \bar v \cup w \cup H^{n-1} = \overline{h(v,w)},
\end{align*}
since the cup product is graded commutative. Thus $h$ is hermitian. Moreover, for $v, w \in H^1(X,\mathbb Z)$, we have
\begin{align*}
h(v,w) &= \frac{1}{4\pi^2 i} \cdot (2\pi i v) \cup (-2\pi i w) \cup H^{n-1}\\
&= -i \cdot v \cup w \cup H^{n-1}.
\end{align*}
This is a purely imaginary algebraic integer, since $v \cup w \cup H^{n-1}$ is an integer.
Finally, we need to check that $h$ is positive definite. This is an immediate consequence of the Hodge index theorem. $\square$
Proof 2 (algebraic, sketch).
Construct the Picard scheme $\operatorname{Pic}_{X/\mathbb C}$ (a lot of work!), and prove that $\operatorname{Pic}^0_{X/\mathbb C}$ is projective, so it is a complex torus. Prove that it coincides with the complex torus $H^1(X,\mathcal O_X)/H^1(X,\mathbb Z)$. $\square$