The Afghanistan cricket team brought joy to its far-flung fans when it beat Scotland by one wicket with three balls remaining Thursday to claim for its first win at the Cricket World Cup.

Samiullah Shenwari produced a brilliant rearguard action to guide Afghanistan to their first World Cup victory with a dramatic one-wicket win over Scotland in their Pool A clash in Dunedin on Thursday.

Shenwari, who had been positively pedestrian for his first 40 runs, was dismissed for 96 after taking charge of his side's chase to 211 runs for the victory at University Oval.

The 28-year-old was dismissed with 19 runs still required from 19 balls but last pairing of Shapoor Zadran and Hamid Hassan managed to get their side to the target with three balls to spare.

Richie Berrington and Josh Davey had ripped through the middle of Afghanistan's order to reduce them from 85 for two in the 19th over to 97 for seven in the 24th.

Mohammad Nabi's side had been well placed to chase down Scotland's 210 all out with Javed Ahmadi well set on 51 before Berrington and Davey struck with five wickets for 12 runs between them.

Shenwari, however, managed to farm most of the strike in a 35-run partnership with Dawlat Zadran and 60-run stand with Hamid Hassan and threatened to get his side home with a maiden century.

He belted three sixes off Majid Haq in the 47th over to get to 96 runs before he was caught in the deep attempting his fourth.

Shapoor and Hassan got their side home, however, Shapoor hitting the winning runs with a four to spark delirious celebrations among the team and a small group of Afghanistan fans.

Afghanistan's pace bowlers, ably supported by Nabi's gentle off-spin, probably felt they had done enough when they dismissed Scotland for 210 on the final ball of the innings.

Shapoor (4-38) and Dawlat (3-29) were the pick of the bowlers, putting pressure on Scotland's batsmen with their accurate line and length even if there was little movement in the air or off the pitch.

Scotland's innings was one of fits and starts as they lost wickets in bunches, consolidated with promising partnerships, only to again lose batsmen in quick succession.

Haq (31) and Alasdair Evans (28) ground out a 62-run ninth-wicket partnership to ensure the Scots lasted the full 50 overs and had something of a target to defend.

Follow @scorewithdata for more stats and analytics

Reuters