5. There are 20 teams participating in the national league. Question: What is the minimum number of matches that must be played so that in any group of three teams, at least two teams have played against each other?
Let team $A$ have the minimum number of matches (which is $k$ matches). Then
(1) There are $k$ teams that have played against team $A$, and each of these teams has played at least $k$ matches;
(2) There are $19-k$ teams that have not played against team $A$, and these teams must all have played against each other, otherwise, the two teams that have not played against each other and team $A$ would not meet the requirements. Therefore, the minimum number of matches is
$$
\begin{array}{l}
N=\frac{1}{2}\left[k+k^{2}+(19-k)(18-k)\right] \\
=(k-9)^{2}+90 \geqslant 90 .
\end{array}
$$

Next, we prove that 90 matches can meet the requirements of the problem.

Divide the 20 teams into two groups, each with 10 teams, and each group conducts a single round-robin tournament.