Pakistan 417 (Shafiq 131, Sarfraz 96, Dilruwan 4-122) and 92 for 0 (Hafeez 46*, Shehzad 43*) beat Sri Lanka 300 (Silva 125) and 206 (Karunaratne 79, Yasir 7-76) by 10 wickets
Scorecard and ball-by-ball details

A seven-wicket haul from Yasir Shah completed an emphatic turnaround from Pakistan, who took the Galle Test by 10 wickets after recovering from a precarious position at the start of the fourth morning. Pakistan had been five down and 182 behind Sri Lanka's first-innings total at the time; few could have predicted then that their openers would waltz to a target of 90 at eight runs an over a day and a half later.

The revival, sparked by Sarfraz Ahmed and Asad Shafiq's sixth-wicket partnership and carried forward by Yasir's fizzing legbreaks on the fifth afternoon, also vindicated Misbah-ul-Haq's decision to bowl first. With the first day washed out, Pakistan's best chance of winning lay in batting just once. As it happened, they almost pulled off an innings win; Mohammad Hafeez and Ahmed Shehzad only needed 11.2 overs to polish off the chase.

Last year, in a Test match between the same sides at the same ground, Sri Lanka took an 82-run first innings lead. At the start of the final day, Pakistan were 4 for 1 in their second innings. A draw looked the likeliest result, but Rangana Herath spun Pakistan out for 180 before Sri Lanka galloped to their target of 99 at a run a ball, with rain lurking around the corner.

Now, the circumstances were neatly reversed, and Pakistan needed someone to step up and match Herath's performance. Yasir showed the earliest possible sign that he would be that man; his first ball of the morning was a perfectly pitched topspinner. Dilruwan Perera, the nightwatchman, didn't pick it, and shouldered arms. It went through with the angle and pegged back his off stump.

From that point until lunch, Dimuth Karunaratne and Lahiru Thirimanne dealt with Yasir's threat comfortably enough to suggest that the turn and bounce that had been in plentiful evidence on the second and third days had slowed down considerably. But their comfort level at the crease didn't translate into easy runs. The bowling was probing throughout, and Zulfiqar Babar and Hafeez tightened the screws by giving away only 10 runs in seven overs as lunch approached.

This spell of constriction may have had something to do with the shot Thirimanne attempted as soon as Wahab Riaz came on for his second spell of the morning, an ambitious on-the-up drive that resulted in an edge to first slip. Wahab produced extra bounce with that ball, but it was still an unwise shot under the circumstances.

That became a theme during the second session. There was some controversy in the manner of Angelo Mathews' dismissal, but it was the shot selection of the younger batsmen that hurt Sri Lanka the most. Karunatne gritted it out for 173 balls before getting stumped attempting an atrocious heave against Yasir. Trying to hit himself out of the vice-like grip exerted by the spinners, Kithuruwan Vithanage holed out at deep square leg. Had they stayed in for a further 20 overs, cumulatively, and scored an extra 50 runs, Pakistan's fourth-innings task may have been a lot more challenging.

But the Mathews wicket was still pivotal, both in terms of importance and timing. Wahab had dismissed Thirimanne minutes before lunch, and had broken a 69-run fourth-wicket stand; now Mathews was facing the second ball after lunch.

Mathews was done in by the limits of two-dimensional replays to determine what happened in a three-dimensional world. The ball from Yasir slid on with the angle and as Mathews pressed forward to defend, it either brushed his inside edge or slid past it, before bouncing off his front pad into short leg's hands.

Umpire Richard Illingworth gave it out, and Mathews immediately reviewed. Split-screen replays suggested Mathews might not have edged it, with the ball appearing to have passed the bat while viewed from the square-on angle when bat and ball were closest together from the front-on angle. Whether that was conclusive evidence or not is debatable; the third umpire thought not, and Illingworth's decision stood.

Sri Lanka were now 144 for 5, effectively 27 for 5. Yasir, who had looked a little flat since dismissing Dilruwan with the first ball of the day, was re-energised. The zip was back, the ball was dipping on the batsmen when they came down the track, and ripping past their edge when they pressed forward to defend.

Dinesh Chandimal was finding ways to score runs at one end, defending solidly and using his feet well when the ball was tossed up, but the lower order gave him no support. Dhammika Prasad ran down the track to Zulfiqar Babar, slogged, and missed by a mile. Herath slogged Yasir straight to deep midwicket.

Eventually, Yasir produced one that was too good for Chandimal, drawing him out with flight and defeating him with dip and sharp turn. Chandimal groped in front of his body and tried to whip against the turn, to no avail. Sarfraz completed his third stumping of the innings, Yasir had picked up his first seven-for in first-class cricket.

Karthik Krishnaswamy is a senior sub-editor at ESPNcricinfo