London - Moeen Ali made Pakistan pay for their latest fielding lapses with a century that saw England fight back on the first day of the fourth Test at The Oval on Thursday.
Ali's 108 was the cornerstone of England's 328 all out.
And there was still time in the two overs before stumps for Stuart Broad to have Sami Aslam lbw for three.
Pakistan ended the day three for one, with both Azhar Ali and nightwatchman Yasir Shah yet to score a run between them.
England, 2-1 up in the four-match series and bidding to become the world's top-ranked Test side, collapsed to 74 for four before lunch after captain Alastair Cook won the toss.
They were still struggling at 110 for five when number seven Ali came in.
But Ali, missed on nine and 15, turned the tide in a fifth-wicket stand of 93 with Jonny Bairstow (55) that followed their key partnership of 152 in England's 141-run win in the third Test at Edgbaston last week.
The off-spinning all-rounder also added 79 in just 86 balls with Chris Woakes (45).
Sohail Khan took five for 68 -- his second five-wicket innings haul in as many Tests -- including a burst of three for six in 13 balls that reduced England to 286 for nine.
At that stage, Ali was still 11 runs shy of a hundred.
But last man James Anderson stuck in for long enough to allow Ali to go to a third hundred in 30 career Tests in style by dancing down the pitch and lofting leg-spinner Shah for six high over mid-wicket.
Off-spinning all-rounder Ali's second Test hundred of the season, following his 155 not out against Sri Lanka at Chester-le-Street in May, took 140 balls, with 12 fours and two sixes.
Ali was last man out when he was caught in the deep by Shah hooking at Sohail, who kissed the pitch in celebration of his fifth wicket.
Cook decided to bat first despite overcast conditions and a green-tinged pitch offering the promise of assistance for Pakistan's seamers.- Sohail sparks collapse -
England were 69 for one when left-hander Cook (35) played on after under-edging a pull off Sohail.
That was the start of a slump that saw three wickets lost for five runs in 15 balls.
Pakistan made two changes to the side beaten at Edgbaston, bringing in debutant batsman Iftikhar Ahmed for Mohammad Hafeez and recalling Riaz in place of fellow left-arm quick Rahat Ali.
Riaz, who took five wickets on his Test debut during Pakistan's four-wicket win at The Oval in 2010, had Joe Root out for 26 as he edged a wide but lifting delivery outside off stump to wicket-keeper Sarfraz Ahmed.
James Vince (one) then fell in similar fashion to an even better Riaz delivery.
England had added just two runs to their lunch score of 92 when Bairstow, on 13, square cut Riaz to backward point only for South African umpire Marais Erasmus to correctly call no-ball.
Pakistan, whose close catching has proved fallible this series, then saw Azhar twice drop Ali on nine and 15.
Azhar should have held the first chance in the slips, off Amir.
Azhar -- now at short leg -- was the unable to hold a far harder catch following Ali's powerful whip off Shah.
Thursday's second session also saw Amir bowl his first no-ball in international cricket since his return earlier this year -- although it was nothing like the deliberate overstep against England in the Lord's Test of 2010 that led to his five-year ban and jail sentence for spot-fixing.
Players and officials wore black armbands in memory of the more than 70 people killed during an explosion at a hospital in Quetta, south-west Pakistan, on Monday.
After lunch, it was confirmed that Pakistan's Hanif Mohammad, one of cricket's greatest batsmen and the original 'Little Master', had died aged 81 after a prolonged illness