It is better to repeat after the muezzin and then pray tahiyyat al-masjid, so that you will have done two acts of worship together, namely repeating after the muezzin then praying tahiyyat al-masjid. But if it on a Friday before the Jumu`ah Prayer, then it is better to hasten to pray tahiyyat al-masjid so that you can focus on listening to the khutbah, because listening to the khutbah is more important that repeating after the muezzin.

Sheikh Ibn `Uthaymeen, a prominent Saudi Muslim scholar (may Allah shower mercy on his soul), said: If you enter when the muezzin is giving the call for Jumu`ah Prayer, the Adhan that is given when the khateeb (speaker) is on the pulpit, in this case we say that you should hasten to pray tahiyyat al-masjid and you should not wait until the muezzin has finished because preparing yourself to listen to the khutbah is more important than repeating after the muezzin, as listening to the khutbah is obligatory and responding to the muezzin is not obligatory.

But if the Adhan is not for Jumu`ah Prayer, then it is better for you to remain standing until you have responded to the muezzin, and offered the well-known du`aa’ (supplication) after the Adhan: “O Allah, the Lord of this perfect Call and the Prayer we are about to offer! Grant Muhammad the privilege (of intercession) and honor, and raise him up to the eminent position that You have promised him.” Then after that you can pray tahiyyat al-masjid.