Afghanistan 211 for 9 (Shenwari 96, Ahmadi 51, Berrington 4-40) beat Scotland 210 (Shapoor 4-38, Dawlat 3-29) by one wicket
Scorecard and ball-by-ball details

For the second time in two days the Associate head-to-head produced a magnificently compelling contest, a finish filled with tension and drama as Afghanistan's last-wicket pair hauled them to a famous one-wicket victory in Dunedin following an epic innings by Samiullah Shenwari.

When Shenwari, who had been dropped on 20 at slip by Majid Haq, hammered three sixes off Haq's last over he appeared to be guiding his side to the win but attempting a fourth he picked out deep midwicket. For a moment time stood still (and not because of the speed of Haq's bowling) as there was uncertainty over whether Scotland had the correct number of fielders inside the circle, but the umpires were satisfied.

It meant Hamid Hassan, who had provided priceless support for Shenwari in the ninth-wicket stand of 60, and Shapoor Zadran were left needing 19 off 19 balls. Every delivery was a minor epic. Ultimately it was Shapoor who found the runs that will forever he etched in Afghanistan history by securing a maiden World Cup victory: a boundary off the final ball of the 49th over, then the winning hit, with a whip off his hip, against Iain Wardlaw the ball after he could have been run out if Scotland had found a direct hit.

Afghanistan seemingly had no chance when they slumped to 97 for 7. The slide was sparked by Richie Berrington's medium pace and involved a collapse of 5 for 12 after Javed Ahmadi had struck a brisk half-century. But Shenwari was magnificent in his calmness and assessment of the situation, firstly with Dawlat Zadran for company as the pair began to chip away at the target with an eighth-wicket stand of 35.

Shenwari's reaction when Dawlat slogged to mid-off encapsulated Afghanistan's emotions as he showed his disgust well before the fielder had taken the catch then stayed on his haunches. Hassan, though, rarely moved away from the block or the push as he heeded to Shenwari's instructions as he opted for a mixture of farming the strike and trusting his partner.

When Shenwari struck his first six, and the first of the match, in the 39th over it felt like nothing more than late defiance but his second, the first of four against Haq, brought the runs required to 50 and Afghanistan started to believe.

It was an understandable gamble by Preston Mommsen to leave Haq so deep into the innings - having stacked the earlier overs with seam when Afghanistan collapsed - and it probably helped Shenwari that he had little choice but to take on his final over with the requirement having stretched to 38 off 24 balls.

When Scotland had been well in control an hour earlier, their coach Grant Bradburn was interviewed by the host broadcaster and naturally wore the expression of a man confident of victory. When the game finished there were grim looks in the Scotland camp as they faced the prospect of another winless World Cup campaign.

At one stage, when Afghanistan were 85 for 2 after 18 overs, the chase was far more under control. It had been steadied by Ahmadi and Shenwari following two wickets in an over for Alasdair Evans who had earlier been involved in Scotland's own lower fightback with Haq.

But Ahmadi threw his wicket away when he picked out mid-on then Josh Davey removed Mohammad Nabi lbw as the innings started to wobble, although it was a stump-grazer upheld by DRS. Berrington's wicket-to-wicket nibblers continued to cause all sorts of problems; Afsar Zazai played around a straight ball and Najibullah Zadran flashed to slip.

Haq was the fielder again when Gulbadin Naib fended into the cordon and his earlier fluff in the slips was quickly being forgotten until Shenwari started to turn the game on its head.

In the field, Afghanistan had been on top for long periods until Scotland pushed themselves over 200 for the first time in World Cups. Making use of early movement, they reduced Scotland to 40 for 3 and then surged again later in the innings, claiming 5 for 51 to leave them tottering on 144 for 8.

Alongside the damage caused by the three main three quicks, Nabi and the recalled Naib claimed a valuable wicket apiece, while the 30 overs between Dawlat, Shapoor and Hassan cost just 99 runs.

Scotland's batting again suffered from failing to convert starts into something more substantial. Four of top six fell between 23 and 31, but unlike against New Zealand and England they were able to make up some ground against their fellow Associate.

Dawlat struck first ball against Sri Lanka and only needed six deliveries this time when Calum MacLeod slashed to point. He and Shapoor shared seven wickets while Hamid chipped in with the scalp of Hamish Gardiner after a terrific working over which included three consecutive throaty appeals.

Scotland lost their way a second time against the change bowlers as Matt Machan gave himself too much room facing Nabi and Mommsen edged a good delivery from Naib. Shapoor then fired up, extracting Matthew Cross from round the wicket as Zazai plucked out a terrific catch to his right then Davey drove to mid-off with 17 overs of the innings still remaining.

When Berrington became Dawlat's third it seemed unlikely Scotland would be able to see out their innings, but Haq and Evans played sensibly in a Scottish record ninth-wicket stand. The expectation was that they had done enough to make the second innings a fascinating contest. No one could quite have imagined how it would unfold.