  We show that if the second eigenvalue $\lambda$ of a $d$-regular graph $G$ on
$n \in 3 \mathbb{Z}$ vertices is at most $\varepsilon d^2/(n \log n)$, for a
small constant $\varepsilon > 0$, then $G$ contains a triangle-factor. The
bound on $\lambda$ is at most an $O(\log n)$ factor away from the best possible
one: Krivelevich, Sudakov and Szab\'o, extending a construction of Alon, showed
that for every function $d = d(n)$ such that $\Omega(n^{2/3}) \le d \le n$ and
infinitely many $n \in \mathbb{N}$ there exists a $d$-regular triangle-free
graph $G$ with $\Theta(n)$ vertices and $\lambda = \Omega(d^2 / n)$.
