$\textbf{Attention Mathstudent:}$ I think you need to assume that $E$ is Hausdorff.
Here are some preliminary thoughts on your problem . I think we are ready to prove the other direction. Recall that if you can show that given any closed set $B$ in $Y$, the preimage under $f$ is also closed then you have proven that $f$ is a continuous function. Now we already know that the canonical projection $\pi_2 : E \times F \longrightarrow E$ is a continuous function. Therefore since $(E \times B) = \pi_2^{-1}(B)$ and $B$ is closed it follows that $(E \times B)$ is a closed subset of $E \times F$. Furthermore we know that $\operatorname{graph}(f)$ is a compact subset of $E \times F$ so consider
$$\operatorname{graph}(f) \cap (E \times B).$$
Now note that $\operatorname{graph}(f) \cap (E \times B)$ is closed in the graph of $f$. Since a closed subspace of a compact space is compact, it follows that
$$\operatorname{graph}(f) \cap (E \times B)$$
is compact. Now we use the following theorem from Munkres:
$\textbf{Theorem 26.6 (Munkres)}$
Let $f : X \rightarrow Y$ be a bijective continuous function. If $X$ is compact and $Y$ is Hausdorff, then $f$ is a homeomorphism.
In our case we have $f$ being $\pi_1|_{\operatorname{graph}(f)}: E \times F \longrightarrow F$, $X = \operatorname{graph}(f)$ and $Y= E$. Now note that $\pi_1$ when restricted to the graph of $f$ becomes a bijective function. To be able to apply your theorem we need that $E$ is Hausdorff (because otherwise the hypotheses of the theorem are not satisfied). Assuming this, the theorem gives that since $\Big(\operatorname{graph}(f) \cap (E \times B)\Big)$ is a compact subset of the graph,
$$\pi_1|_{\operatorname{graph}(f)} \Big(\operatorname{graph}(f) \cap (E \times B)\Big) = f^{-1}(B)$$
is compact. Now we use the assumption again that $E$ is Hausdorff: Since $f^{-1}(B)$ is a compact subset of $E$ that is Hausdorff it is closed so you are done.
$\hspace{6in} \square$
So, let's consider an open $K \subset X$, then its complement is closed. Closed subspace of a compact space is also compact. Let $f: X \rightarrow Y$ - continous map. Then, since the image of a compact set is compact (the map is continous), $Y - f(K)$ is compact. Since the compact subspace of a Hausdorff space is closed, $Y - f(K)$ is closed and then $f(K)$ is open.
So, $f$ maps open spaces to open spaces and this also is true for $f^{-1}$.
Best Answer
Proof without nets:
Let $G$ be the graph of $f$.
Suppose $G$ is compact.
Let $A$ be closed in $\mathbb R$. We show $f^{-1} [A]$ is closed.
Note that $f^{-1}[A]=\pi_X [G\cap (X\times A)]$.
Since $G\cap (X\times A)$ is compact and the projection $\pi _X$ is continuous, $f^{-1}[A]$ is compact.
$X$ is Hausdorff, so every compact subset of $X$ is closed. DONE!