I believe this is a special case of a more general fact; I am not sure of all the signs off the top of my head, but here  is the idea. 

If $M$ and $N$ are orientable $d$-manifolds, the Künneth theorem gives

$$H^d(M \times N; \mathbb{Q}) \cong \bigoplus_k H^k(M; \mathbb{Q}) \otimes H^{d-k}(N; \mathbb{Q}).$$

To the second factor we first apply Poincare duality $H^{d-k}(N; \mathbb{Q}) \cong H_k(N; \mathbb{Q})$ and then the usual duality $H_k(N;\mathbb{Q})\cong H^k(N;\mathbb{Q})^\ast$ to rewrite this as

$$H^d(M \times N; \mathbb{Q}) \cong \bigoplus_k \text{Hom}\big( H^k(N; \mathbb{Q}), H^k(M; \mathbb{Q}) \big).$$


For any continuous map $f\colon M \to N$, the graph $\Gamma_f$ of the map $f$ is a $d$-dimensional submanifold of $M \times N$, so we can consider its class

$$[\Gamma_f] \in H^d(M \times N; \mathbb{Q}).$$


Claim: under the above isomorphism, we have

$$[\Gamma_f] = \bigoplus_k \big[\ f_{(k)}^*\colon H^k(N; \mathbb{Q}) \to H^k(M; \mathbb{Q}) \big]$$

where $f_{(k)}^*$ denotes the map induced on $k$-th cohomology by $f$.

There might be some signs missing here, but other than that I believe this is correct. (I don't know a reference for this, so if anyone does have a reference, I'd be grateful.) In particular, it doesn't seem that you need to assume that $\phi$ is an isomorphism, only continuous, or that $M$ and $N$ are surfaces.

As an aside, if you apply this twice with $M=N$, once to $\text{id}\colon M\to M$ and once to $f\colon M\to M$, you should be close to proving the Lefschetz fixed point theorem.

-----

Edit: as David Speyer points out, this aside requires knowing that intersection of submanifolds is Poincare dual to the cup product. A reference for this can be found in the textbook "Differential forms in algebraic topology" by Bott and Tu, in 6.31 (on page 69): "under Poincare duality the transversal intersection of closed oriented submanifolds corresponds to the wedge product of forms". (From one perspective, this is the most important thing to know about cup product!)

Also, Mark Grant has kindly provided a reference for the fact I claimed above: this is proved in his answer to [this Math Overflow question][1] from 2010, by reducing the claim to the case of the diagonal embedding (i.e. when $f=\text{id}$).


  [1]: https://mathoverflow.net/questions/23011/graphs-as-cycles-and-intersection-theory/50821#50821