Short answer
Yes. Praying behind an imam who follows another of the four schools is valid, and Muslims have done so for centuries. Follow the imam in the prayer and keep your own practice in small details, such as raising your hands. In the Hanafi view the only concern is if you know for sure he did something in that prayer that breaks it in your school.
Following an imam of another Sunni school is valid. The prayer is affected only if the follower knows for certain that the imam did something that invalidates prayer in the Hanafi school, such as not renewing wudu after bleeding; when unsure, it is valid. If the imam recites qunut in Fajr, the Hanafi follower stands silently.
The four schools agree on this.
Explanation
The four schools are all within Sunni Islam, and their differences are over evidence, not over faith. The Companions and the great imams prayed behind each other despite their differences. The Prophet ﷺ said of imams: they lead you in prayer, and if they get it right it is for you, and if they get it wrong it is for you and against them. The four schools agree that praying behind an imam of another school is valid.
- Raising the hands, Ameen, where the hands go: do your own school's practice. These are sunnahs and do not affect following.
- Qunut in Fajr: stand silently with your hands at your sides until the imam goes into sajdah, then follow him.
- Witr split into two and one: Hanafi scholars differ on following; many advise praying your witr separately.
- Asr at the earlier time: see when Asr begins on the two Hanafi views.
The prayer is affected only if you know the imam did something in that prayer that breaks it in the Hanafi school, for example you saw him bleed and not renew his wudu. You are not required to investigate, and you should not quiz imams. Assume the prayer is fine.
For how the two schools differ, read Hanafi vs Shafi'i. See also who should lead the prayer.
The evidence
Sahih al-Bukhari 694
Sahih... يصلون لكم فإن أصابوا فلكم وإن أخطئوا فلكم وعليهم ...
"They lead you in prayer: if they are right, it is for you, and if they err, it is for you and against them."
The follower's prayer stands even if the imam makes a mistake.
Where the ruling is recorded
- Radd al-Muhtar (Ibn Abidin), Kitab al-Salah, chapter on the imamate. Following an imam of another school is valid unless the follower knows he did something invalid in the follower's school.
- al-Hidaya, Kitab al-Salah, chapter on witr. A follower of an imam who recites qunut in Fajr remains standing silently, according to Abu Hanifa and Muhammad.
This answer is pending review by the scholars on our team. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.