Q to P: a singleton set is compact in $Y$ so $f^{-1}(y)$ compact immediately follows.
To see $f$ is closed, let $C$ be closed in $X$ and $y \in \overline{f[C]}$ which means there is a sequence $(x_n)$ in $C$ such that $f(x_n) \to y$. Now $K =\{f(x_n): n \in \mathbb{N}\} \cup \{y\}$ is compact (any convergent sequence together with its limit is) and so $f^{-1}[K]$ is compact. The sequence $(x_n)$ lies in $f^{-1}[K]$ and so there is a $x \in K$ and some subsequence $(x_{n_k})_k$ such that $x_{n_k} \to x$ as $k \to \infty$. As all $x_n$ are in $C$, and $C$ is closed we know that $x \in C$ and by continuity of $f$ we know that $f(x_{n_k}) \to f(x)$ and by construction the sequence $f(x_n)$ is convergent to $y$ and so this subsequence has the same limit $y$. So unicity of limits tells us $y=f(x) \in f[C]$. This shows $\overline{f[C]} \subseteq f[C]$ or $f[C]$ is closed. This shows $f$ is closed.
Note that this direction does require some metric specific facts ($X$ is sequential, and compactness implies sequential compactness etc.) that do not hold in general spaces, while P to Q is completely general and always holds. A continuous map obeying Q is often called "proper" and one obeying P "perfect". We see here that for metric spaces this is the same. In general they can differ, though.