Example 2. Color the five vertices of a square pyramid so that the two endpoints of the same edge have different colors. If only 5 colors are available, how many different coloring methods are there?
Analysis: As shown in the figure, let the quadrilateral pyramid be $\mathrm{A}-$ $B C D E$, starting the coloring from point $\mathrm{A}$, $\mathrm{A}, \mathrm{B}, \mathrm{C}$ have $5, 4, 3$ coloring methods respectively. (1) If $\mathrm{D}$ is the same color as $\mathrm{B}$, then $\mathrm{D}$ has only 1 coloring method, and $\mathrm{E}$ has 3 coloring methods, i.e., $5 \times$ $4 \times 3 \times 1 \times 3=180$ ways; (2) If $\mathrm{D}$ is a different color from $\mathrm{B}$, then $\mathrm{D}$ has 2 methods, and $\mathrm{E}$ also has 2 methods, i.e., $5 \times 4 \times$ $3 \times 2 \times 2=240$ ways. In total, there are $180+240=420$ coloring methods.