If $Y$ is compact and $f : X \rightarrow Y$ is a map whose graph $G = \{ (x,f(x) : x \in X\}$ is closed in $X \times Y$ , then $f$ is continuous. 
If $Y$ is compact and $f : X \rightarrow Y$ is a map whose graph $G = \{ (x,f(x) : x \in X\}$ is closed in $X \times Y$ , then $f$ is continuous.

Let $C \subseteq Y$ be a closed. Let $x \in X - f^{-1}(C)$. We want to show that there is an open neighborhood $U$ of $x$ in $X - f^{-1}(C)$.
For each $c \in C$, that there is an open neighborhood $U_c \times V_c$ of $(x,c) \in (X \times Y)-G$, since the graph is closed. Since $Y$ is compact, a finite number of the $V_c$ cover $C$. Denote them as $V_{c_1}, ... , V_{c_N}$ for some $N \in \Bbb{N}$. We claim that $\bigcap_{i=1}^N U_i$ is an open neighborhood of $x \in X - f^{-1}(C)$. 
Suppose, for contradiction, that we have $f^{-1}(c) \in \bigcap_{i=1}^N U_i$ for some $c \in C$. We know that $c \in V_i$ for some $1 \leq i \leq N$. Since $f^{-1}(c) \in \bigcap_{i=1}^N U_i$, $f^{-1}(c) \in U_i \implies (f^{-1}(c), c) \in U_i \times V_i$ contradicting the fact that $U_i \times V_i \subseteq (X \times Y) - G$.
Is my answer correct?
 A: Your answer is al(most)right just a few things to mention :


*

*Choose C such that the complement of the pre image is non empty. 

*you don't want to show that the pre image of the intersection is a neighborhood of x (this holds by definition) but that it is contained in the complement of the pre image of C

*you write that the pre image of $c \in C $ is an element but this is rather a set. You can choose a point $y \in f^{-1} $ which then maps to c. 


(Sorry for typos I'm writing from my mobile phone) 
A: As $Y$ is compact, the projection $\pi: X \times Y \rightarrow X$ is a closed (and continuous) map. E.g this is proven here, among other places. 
Let $C$ be closed in $Y$, we need (for continuity of $f$) that $f^{-1}[C]$ is closed in $X$.
Note that $$f^{-1}[C] = \pi[(X \times C) \cap G]$$
As $X \times C$ is closed in $X \times Y$ and $G$ is closed as well, we have that $f^{-1}[C]$ is the image of a closed set under the closed map $\pi$, so is closed, as required.
A: You may also be interested in another approach to this theorem based on nets and subnets rather than on open covers, see Chapter 3 in http://www.apronus.com/math/MRWojcikPhD.htm.
