Praise be to Allah.
“It is preferable for him to repeat after the muezzin, then make du’aa’ after that as narrated (in the Sunnah), then pray Tahiyyat al-Masjid (two rak’ahs to “greet the mosque”). But some of the scholars made an exception in the case of one who enters the mosque when the muezzin is calling the second adhaan on Friday. In this case he should pray Tahiyyat al-Masjid so that he can then listen to the khutbah. Their basis for saying that was that listening to the khutbah is obligatory (waajib) whereas repeating after the muezzin is not obligatory, so observing that which is obligatory takes prioirty over observing that which is not obligatory.”
(Fatawa Arkaan al-Islam by Ibn ‘Uthaymeen, p. 28)
Some scholars said that it is better to combine the two, by repeating after the muezzin, because this is prescribed, then praying two short rak’ahs. And Allah knows best.