Barry McCarthy talks after his maiden five-for that helped Ireland level the series with Afghanistan

Ireland captain William Porterfield has a long-established habit of chasing in limited-overs cricket. So it was a big surprise that on Thursday, after winning the toss, he decided to bat. Even more surprising was that, having left Boyd Rankin out, the man who rattled Afghanistan with 4 for 44 in the first ODI, Ireland stormed back to level the series with a 51-run win behind a maiden ODI five-for from his replacement in the XI, Barry McCarthy.

Having been humbled by teenage spin phenom Mujeeb Zadran on ODI debut, the onus was on the openers Porterfield and Paul Stirling to repel his variations so that the middle order wasn't exposed early. The pair did that and more, using the sweep to upset Mujeeb's line and length during the course of a 115-run opening stand.

Porterfield fell for 47, caught by mid-off while trying to pull Gulbadin Naib, and that opened the door for Afghanistan's spinners. Mujeeb struck next over, trapping Andy Balbirnie with a standard offbreak. Ireland regrouped briefly before three wickets fell with the score on 160. Stirling, the key scalp for 82, and Gary Wilson were dismissed by back-to-back googlies from Rashid and then Niall O'Brien was out stumped attempting to drive Mujeeb. When Kevin O'Brien played around a fuller delivery from Dawlat Zadran a short time later, the score became 188 for 6 after 37.3 overs.

But Afghanistan's intensity waned and George Dockrell exploited it well enough to more than doubling his previous ODI best of 28. A scorching straight six in the final over off Mohammad Nabi propelled him to 62 not out.

That lull in the field over the final 10 overs proved costly in the end for Afghanistan. After a methodical start from their openers, McCarthy got his banner night started by dismissing Ihsanullah in the 12th over.A 51-run stand between Javed Ahmadi and Rahmat Shah steadied Afghanistan, but McCarthy struck again, luring Ahmadi into a pull shot straight to deep square leg.

All the while, Afghanistan's batsmen looked comfortable but lacked for a sense of urgency. And their concentration kept faltering. Rahmat Shah overbalanced to be stumped off Dockrell and captain Asghar Stanikzai needlessly slogged Tim Murtagh to deep midwicket. The hammer blow, however, was struck by Peter Chase in the 38th over. With Mohammad Nabi humming and the required run-rate dragged down to just about a run-a-ball, the batsman dragged an expansive drive back onto the stumps.

Sensing the opportunity to steal a win, Ireland's fielding was near flawless in their final 13 overs. Stuart Poynter plucked a sharp catch at midwicket to send Naib back and give Chase his second wicket. Porterfield took a stunner to dismiss Nasir Jamal off McCarthy's bowling in the 43rd over. The very next ball, Shafiqullah was bowled for a golden duck.

McCarthy claimed his fifth wicket in dramatic style, yorking Dawlat in the 45th over. The match ended two balls later with Mujeeb being run-out after he dropped his bat. And so the night ended with Afghanistan receiving a rude wake-up call from Ireland's medium pacers. It also set up a winner-take-all final round on Sunday.