England started their innings as the sun began to set in the City of Lights and were 7-1 at the close of play, with opener Zak Crawley out for a duck in the first over.
The tourists had been without a wrist spinner for the series after Liam Livingstone sustained a knee injury in the first Test match at Rawalpindi, but Ahmed finished the day with two wickets for 89 runs across three spells.
With only three first-class matches under his belt for Leicestershire, the 18-year-old took a session to find his line and length consistently after going into the lunch break with figures of five overs for 37 runs, but he was markedly more composed after the break.
Ahmed's first wicket came when he cleverly set up Saud Shakeel before the Pakistan batter was caught by Ollie Pope at short leg.
It was a first glimpse of the talent spoken about by Stokes and head coach McCullum when he beat Saud with a googly turning past the bat, before following it up with a wicket-taking leg-spinner that just took the edge.
Ahmed's second came in the evening session, when Faheem Ashraf was trapped lbw for just four, with DRS upholding the decision following a review to leave Pakistan on 237 for seven.
However, the key wicket of Babar Azam was secured by an exceptional bit of wicketkeeping from the returning specialist Ben Foakes.
Foakes, who was left out in favour of batter-wicketkeeper Pope for the Multan Test, dived forward to take a throw then with a clever bit of glovework managed to whip the bails off before the Pakistan captain passed the crease.
As the sun began to set in Karachi, England claimed the remaining three wickets in quick succession, with Jack Leach finishing the day with four for 140 from 31 overs as Pakistan slid from 162 for four to 304 all out.
Only Babar (78) and Agha Salman (56) were able to reach half-centuries in the Pakistan innings, with wickets falling consistently throughout the day.
Crawley was out for a duck as England began their first innings, with Abrar Ahmed claiming his first wicket of the match.
The England opener was trapped lbw having faced just five deliveries and decided not to review.
In the morning, the tourists had turned immediately to spin, with Leach becoming the first England spinner to open the bowling in the first innings of a match since 1921, when Jack White did so against Australia at Headingley.
England claimed three wickets in the first session of play, which set the tone for the rest of the day as they continued to make breakthroughs at key times and limited Pakistan's ability to form significant partnerships.