(CNN) -- Sri Lanka made it five wins out of five as they strode into the World Twenty20 semifinals with a 48-run victory that ended New Zealand's challenge at Trent Bridge, Nottingham, on Tuesday.
Mendis swung the balance Sri Lanka's way with three wickets as his unbeaten side made the Twenty20 semis.
New Zealand, chasing 159 to win, appeared on track for a nailbiting finish in the Super Eights decider after amassing 64 for two wickets after eight overs.
Martin Guptill top-scored with 43, but the Black Caps were skittled for 110 after losing their last eight wickets for 46 runs with spinner Ajantha Mendis claiming three for nine.
"Ajantha was brilliant. He is very difficult to read and he has an attacking mindset. It's a great ability to have," said Sri Lanka skipper Kumar Sangakkara.
Sri Lanka now travel to The Oval in south London for the second semifinal on Friday when their opponents will be the West Indies.
Pakistan take second spot in the group with four points, two more than New Zealand, and play the first semifinal against South Africa at Trent Bridge on Thursday.
South Africa also made it five wins from five after AB de Villiers and Johan Botha helped secure a 12-run win over India in the later match.
In what was effectively a dead rubber the sides managed to create some drama, with India needing 20 to win from the last over -- a target they never looked like overhauling.
Stung by their own exit from the tournament the holders put in a committed performance in the field, with Ravindra Jadeja the pick of eight bowlers with figures of one for nine off three overs.
But De Villiers hit seven fours on his way to 63 as tournament favorites South Africa edged to 130 for five.
That gave India hope of a morale-restoring win but after an opening stand of 48, Botha took over to return three for 16 in a total of 118 for eight.
New Zealand captain Daniel Vettori admitted batting let his side down saying: "It was a gettable total but in three major matches our highest score was 120.
"We got off to a decent start, then capitulated in the middle. But thay have a wonderful attack and deserved to win."
Mendis swung the balance Sri Lanka's way with two wickets in four balls, having Ross Taylor stumped before bowling Scott Styris.
Another two wickets fell for as many runs when Isuru Udana bowled Jacob Oram and Jayasuriya had Guptill caught on the square-leg fence by Angelo Mathews.
Sri Lanka continued to strike at regular intervals to wrap up the match with three overs to spare.
Earlier, Kumar Sangakkara made 35 to anchor his side to 158-5 after he won the toss and elected to bat on a good wicket.
Sangakkara put on 62 in 49 balls for the third wicket with Tillekaratne Dilshan (48) and 50 for the fourth with former captain Mahela Jayawardene (35) as Sri Lanka showed their class.