Danushka Gunathilaka was only called up as a late replacement but his superb knock helped Sri Lanka keep their Champions Trophy bid alive with a shock seven-wicket win over India.

Gunathilaka may not even have played had it not been for an injury to Chamara Kapugedera but the stand-in became the star, hitting 76 in 72 balls from the top of the order as Sri Lanka cruised past India’s target of 321.

Kusal Mendis also made an excellent 89 and captain Angelo Mathews an unbeaten 52 as Sri Lanka hauled themselves back into contention for qualification to the semi-finals and in doing blew Group B wide open.

India were strong favourites to all-but secure their own progress with a victory here at the Oval but defeat leaves all four teams on two points with one match still to play.

Sri Lanka will face Pakistan on Monday, 24 hours after India go up against South Africa on Sunday.

Earlier, Shikhar Dhawan had scored 125 along with strong contributions from Rohit Sharma (78) and MS Dhoni (63) but few would have predicted Sri Lanka recording their second highest chase in one-day history.

They made a stuttering start when Niroshan Dickwella’s leading edge popped up to Ravindra Jadeja at point and after a heavy defeat to South Africa last week, an Indian win looked certain.

Instead, Gunathilaka and Mendis put on a partnership of 159, riding their luck at times, but also with smart and subtle batting that confounded India’s bowlers.

Gunathilaka steered Hardik Pandya for six to bring up his 50 from 47 balls and Mendis followed suit soon after by launching Ravindra Jadeja over the boundary.

In between, Yuvraj Singh had misjudged a high Mendis shot he should have caught and Gunathilaka was fortunate too when a scrambling Rohit let another spill through his fingers.

But just as Sri Lanka’s hopes were rising their task became more difficult, two run-outs spelling the end for each of their established batsmen.

Gunathilaka called an ambitious second run, only to watch Dhoni divert Kedar Jadhav’s pin-point throw on to the stumps and then bowler Bhuvneshwar Kumar reacted fast to crack the bails again, this time leaving Mendis sprawled with his face in the turf.

But if India hoped that would spark a change in momentum, they would soon be disappointed as Mathews, returning from a calf injury, and Kusal Perera continued to crank up the pressure.

Perera was forced to retire hurt in the 43rd over after pain in his hamstring but not before adding an unbeaten 47 to the total, with Sri Lanka now needing 51 off 42 balls.

Mathews was also taking treatment between overs but he and Asela Gunaratne (34 not out) showed no signs of weakness.

Gunaratne swept Jasprit Bumrah for six off one knee before Mathews drove down the ground to bring the score level and then nicked a single to seal a stunning win with eight balls to spare.

Sri Lanka captain Angelo Mathews: For Danushka to walk into a game knowing he wasn’t even in the 15 until after Chamara got injured is impressive. He had to step in against a very strong opposition and I was very impressed with how he batted. He and Kusal played with a lot of freedom and that set us a platform and made it so much easier for myself and the middle order batters. Asela’s little cameo as well really won us the game at the end so it was a fantastic batting effort.”

India captain Virat Kohli: “I personally thought we had enough on the board. You have to give credit to the opposition as well. We are not invincible. We are playing against a champion side. These are the top eight teams in the world so there are no guarantees. We have to consolidate and then explode at the end, that’s how we play. We’re not a side that always plays explosive cricket for the 50 overs.”