Moeen Ali's flamboyant 84 from 93 balls swayed an enthralling second Test in England's favour on a punishing day four for West Indies at Headingley.
The tourists started the penultimate day with the upper hand, England leading by only two runs on 171-3, but Moeen top scored a day after dropping a simple catch as the hosts set them 322 to win after declaring on 490-8.
Dawid Malan enhanced his chances of making the Ashes tour with a patient 61 after being dropped on 32, while captain Joe Root (72) made yet another half-century, having been put down with only 10 to his name on day three.
First-innings centurion Ben Stokes (58) and Chris Woakes (61 not out) were also among six England batsmen to pass 50 in a second innings in which they were 327-7, with a lead of only 158 as a result of three quick wickets from Roston Chase (3-86), before Moeen's onslaught.
Moeen was given a let-off when he was caught behind on 32 off Devendra Bishoo, but the spinner was adjudged to have over-stepped by umpire Sundaram Ravi and the all-rounder took advantage with a devastating knock aided by Woakes in a eighth-wicket stand of 117 - an England record.
The Windies openers came through a testing six overs to close on five without loss, needing another 317 to keep the three-match series alive, but seven dropped catches in the match could deny them a first Test win on English soil for 17 years.
What a test at headingley..test cricket still the best format..one of my favourite venues-- Sourav Ganguly (@SGanguly99) August 28, 2017
Root equalled AB de Villiers' world record of half-centuries in 12 successive Tests in the first innings and for the first time during that run he passed 50 in both innings, raising his bat yet again after guiding Kemar Roach to the third man boundary in the opening over of the day.
The captain was ominously set, but trudged off disconsolately after slapping Shannon Gabriel to Shai Hope, who clung on after a juggling act at gully with England just 43 in front on 212-4.
The hosts ought to have been five down in the next over when Kieran Powell, distracted by wicketkeeper Shane Dowrich diving in front of him, put Malan down at first slip off skipper Jason Holder.
England took lunch with an 82-run advantage and the left-handers looked comfortable when the new ball was taken following the interval, both batsmen bringing up their half-centuries on a good track.
The Windies looked dispirited, but Stokes gave them a huge lift when he launched Chase to Kraigg Brathwaite at long-off from the first delivery after a drinks break to end a stand of 91.
Chase struck again in his next over, cleaning Malan up with a quicker delivery, and the spinner had a third wicket in an excellent spell when Jonny Bairstow chopped on with an ill-advised reverse sweep after he had been dropped by Kyle Hope in the covers driving Holder.
Moeen used up a life when he edged Bishoo behind, but umpire Ravi ruled that the spinner's front foot had crossed the line and the Windies' frustration mounted as he reached his half-century with a sumptuous cover drive.
England's lead moved beyond the 250 mark, but Moeen missed out on a century by lofting Bishoo to Brathwaite in the deep and Root declared after Woakes also passed 50.
Brathwaite and Powell got the Windies through to stumps unscathed, but it is advantage England after turning the tide on a gripping day.