Afghanistan beat Pakistan for the first time in one-day cricket by pulling off their highest successful chase in the format in a World Cup thriller.
Ibrahim Zadran made 87, Rahmanullah Gurbaz smacked 65 and Rahmat Shah struck an unbeaten 77 as Afghanistan reached their target of 283 with eight wickets and six balls to spare.
Afghanistan are up to sixth, leaving holders England bottom of the table.
Captain Babar Azam earlier made 74 as Pakistan posted 282-7 in Chennai.
Teenage spinner Noor Ahmad was the pick of the Afghanistan bowlers, taking 3-49.
It is Afghanistan's first win over Pakistan in ODIs at the eighth attempt, with their total of 286-2 seeing them eclipse their previous record successful chase of 276-8 when set 274 to beat United Arab Emirates in 2014.
It is also only Afghanistan's third World Cup win, after victories over Scotland in 2015 and England earlier in this tournament.
Afghanistan keep hopes alive
The Afghanistan fans in the crowd went wild when skipper Hashmatullah Shahidi hit the winning runs, the players saluting them with a lap of honour, some draped in the national flag.
The match brought back memories of another thriller between the sides at Headingley in the 2019 World Cup, though it is Afghanistan who came out on top this time to finally beat their neighbour in this format.
It also proved Afghanistan's victory over England in Delhi was no fluke as they coped admirably under pressure during the run chase.
Openers Gurbaz and Zadran made a blistering start to ensure they stayed ahead of the required rate, putting on 130 for the first wicket, their second century stand of the tournament.
Gurbaz top-edged to Usama Mir at third man and Zadran was caught behind off Hassan Ali 13 runs short of a century, but Afghanistan showed resilience to maintain their momentum.
Rahmat hit five fours and two sixes in his composed knock, as Afghanistan became the first chasing team in World Cup history to have their top three all make half-centuries.
He was ably supported by Hashmat, who hit 48 not out from 45 balls, in an unbroken third-wicket partnership worth 96 to see Afghanistan over the line.
Pakistan slump to miserable defeat
After beginning the tournament with back-to-back wins, Pakistan have now lost three in a row to leave their semi-final hopes in jeopardy.
They began well with the bat and reached 56-0 after the powerplay, their best 10-over total batting first at this World Cup, but their innings ground to a halt as they were well shackled by Afghanistan's spin-heavy attack.
The star with the ball for Afghanistan was 18-year-old Noor, playing just his fourth ODI and making his World Cup debut.
The left-arm wrist-spinner took the key wickets of Abdullah Shafique, who made 58 from 75, Muhammad Rizwan and skipper Babar to help pin Pakistan down in the middle overs.
When Babar's attritional 92-ball knock ended in the 42nd over, Pakistan were wobbling on 206-5, though Iftikhar Ahmed injected some much-needed impetus late on with a spritely 40 from just 27 balls, including four sixes.
He put on 73 for the sixth wicket with Shadab Khan, who hit 40 from 38, as they lifted Pakistan to what seemed an imposing score before both were dismissed in the final over.
Afghanistan showed tremendous maturity and calmness in the chase, though their cause was helped by sloppy Pakistan fielding, which left team director Mickey Arthur absolutely seething in the dugout.
Pakistan stay in Chennai for their next match against South Africa on Friday. Afghanistan head to Pune to take on Sri Lanka on Monday.
'That really hurt us' - reaction
Afghanistan captain Hashmatullah Shahidi: "This win tastes nice. The way we chased was very professional and the way we did that will help us going into our other games now.
"We are playing quality cricket. We have always had belief and at the start of the tournament I told my team I wanted to make it a historic one for our country and our people. We did that against England and now against Pakistan.
"Our bowling was very good, especially our spinners. We gave Noor a chance and trusted his talent. With the bat, the way we started the innings gave us a lot of confidence and momentum."
Pakistan captain Babar Azam: "That really hurt us. We got a good total. Our bowling is not up to the mark.
"In World Cups you need all three departments firing and we haven't done that. Afghanistan played very well but we gave them a lot of runs and it cost us.
"We were backing ourselves to win, but they played well in all three departments and we didn't. We have got to put that right in our next match."
Afghanistan coach Jonathan Trott, speaking to OceanNewsUK: "Ecstatic is an understatement. We've got some time off now and can let the emotion of it sink in.
"This backs up the victory against England. These boys can play. It's just about putting it together and being consistent."