Pakistan dominate second England Test after Abrar Ahmed's spin magic
The 24-year-old - nicknamed "Harry Potter" by friends because he wears glasses similar to those of the fictional boy wizard - produced magic of his own to finish with 7-114.
In reply, Pakistan were 107-2 at the close, with skipper Babar Azam unbeaten on 61 and Saud Shakeel on 32, trailing by 174 runs.
Of the 12 wickets that fell on the day, James Anderson was the only fast bowler to dismiss a batter when he found an edge off Pakistan opener Imam-ul-Haq, who departed without scoring.
Abdullah Shafique scored 14 before edging spinner Jack Leach to keeper Ollie Pope, but Azam and Shakeel saw off the day with a third-wicket unbroken stand of 56.
The day belonged to the home team and Ahmed in particular.
View the scorecard from the second test at Flashscore
Under pressure to square the series, Azam's wish came true when the pitch took turn from the outset.
He brought on Ahmed in just the ninth over, and the spinner repaid him by bowling Zak Crawley with a sharp incoming delivery - only his fifth ball in Test cricket.
Ahmed then trapped Ben Duckett and Joe Root leg-before - both given out only after Azam reviewed the on-field calls.
He made it 167-5 when Pope and Brook miscued aggressive shots and were caught.
Ahmed was delighted with his effort.
"People do call me Harry Potter, but I am not a magician," he said.
"I have done what is my job, and that is taking wickets."
The moment of the match for him was the scalp of England skipper Ben Stokes.
"My teammates were telling me that usually it's the first wicket that you cherish, but for me, Stokes's wicket was the best."
Stokes (30) and Will Jacks (31) defied the assault after lunch for a 61-run sixth-wicket stand.
Ben Duckett (63) and Pope (60) were the main scorers in an England innings that finished at the stroke of tea, after skipper Stokes won the toss and decided to bat.
Spinner Zahid Mahmood claimed the last three wickets to finish with 3-63.
Ahmed's figures were the second-best on debut by a Pakistan bowler - behind pacer Mohammad Zahid's 7-66 against New Zealand in Rawalpindi in 1996.
He is the 13th Pakistan bowler to take five or more wickets in an innings on debut.
Duckett said he hoped early wickets on Saturday would bring England back into the game.
"Ahmed bowled really well... it's definitely spinning," he said.
"Hopefully we can take wickets in clusters tomorrow."
England, on their first tour of Pakistan since 2005, lead the three-match series 1-0 after winning the first Test in Rawalpindi by 74 runs.