Let $L$ be the starting length of the thread. Let $R(t)$ and $S(t)$ denote the positions of the fly and spider, respectively, at time $t$. Then $R(0) = l$ and $S(0) = 0$.
Then let $r$ and $s$ denote the speeds of the fly and spider, respectively.
Since $R'(t) = r$, we have that $R(t) = L + rt$. The differential equation for $S$ is a bit tricker, but it comes out to
$$
S'(t) = s + \frac{S(t)}{R(t)} R'(t) \tag{1}
$$
or
$$
\frac{d}{dt} \left( \frac{S(t)}{R(t)} \right) = \frac{s}{R(t)} \tag{2}
$$
You can see either of these formulas directly.
For (1), note that there are two contributions to the spider's speed: his own movement $s$, and the movement gained by the string stretching behind him.
$\frac{S(t)}{R(t)} R'(t)$ is simply the rate of change in the length of the portion of string behind the spider. For (2), note that if we pretend
the string has fixed length $1$, the spider's speed as a percentage of the length of the string is given by his speed divided by the length of the string.
At any rate, (2) gives
\begin{align*}
\frac{S(t_1)}{R(t_1)}
&= \int_0^{t_1} \frac{s}{R(t)} \; dt \\
&= \int_0^{t_1} \frac{s}{L + rt} \; dt \\
&= \frac{s}{r} \ln (L + rt_1) - \frac{s}{r} \ln L \\
&= \frac{s}{r} \ln \left(1 + \frac{rt_1}{L}\right) \\
\end{align*}
As long as $s, r, L > 0$,
since $\ln$ is unbounded,
there will be some time $t_1$ such that
$\frac{s}{r} \ln(1 + rt_1 / L) = 1$.
Then for this time $t_1$, $S(t_1) = R(t_1)$.
Thus the spider will eventually catch the fly no matter its speed.
Specifically, the spider will catch the fly at time
$$
t_1 = \frac{L}{r} \left( e^{r/s} - 1 \right).
$$