While a rising ball got a thick edge of Rahane's bat, a lovely inswinger castled Karthik, who was playing a Test match in England after 10 years.
Kohli then topped his 2014 series total in the one knock with a two off leg-spinner Adil Rashid.
Ben Stokes could not continue to convert his start into a big inning as he handed over a simple catch to Ashwin on his bowling.
Alastair Cook has been done in twice by the same ball from Indian master spinner Ravi Ashwin in the first Test at Edgbaston.
The rest of India's batting line-up failed, however, and the tourists were bowled out for 274 in reply to England's 287 as Sam Curran, the 20-year-old from Surrey, took four wickets. He was dropped by Dawid Malan at first slip on 21, edged three times short of fielders behind the wicket, then glanced another edge through the right hand of the diving Malan when on 51.
In fear of being bowled out to leave England well ahead, Kohli took over the task of controlling the innings. I think it was an outstanding effort from them also.
Even Chrissy Teigen Has Had Enough of Thomas Markle
Duchess Meghan is at her wits' end over her father Thomas Markle after he slammed her in a new interview. Markle also brought up the late Princess Diana and said she wouldn't have allowed this treatment of him.
Just as the partnership was starting to look ominous, left-arm swing bowler Sam Curran dismissed Pandya with a brilliant yorker. KL Rahul (4) and Shikhar Dhawan were also dismissed in a matter of few balls by Curran as the match suddenly changed directions with India being 59 for 3.
Kohli, who exorcised the ghosts of the 2014 England tour, brought up his hundred by hitting Stokes for a four and roaring towards the stands to then kiss his wedding ring as wife Anushka Sharma watched from the stands. A score of 54 for 2 - at which point Kohli had walked in - had become 100 for 5.
He claimed three wickets in eight balls as he found some movement.
David Wigan has been on: "Nick - I am not a huge cricket geek so forgive my ignorance in these matters, but can you tell me why Alistair Cook still plays for England?".
Stokes, introduced after lunch, showed why he is such an important part of this England side with an aggressive spell.
Earlier, Jos Buttler was taken to hospital after injuring his left middle finger attempting to take an extremely tough chance off Kohli at gully, but an X-ray revealed it was bruised rather than broken. And I had total clarity that we are going for the target.