Pietersen's 134 was the centrepiece of England's second innings 282, which came to an end at tea on Sunday.
India, dismissed for a meagre 201 in the first innings, now had to score a Lord's Test record fourth innings victory total of 380, surpassing the 344 for one, needing 342, made by the West Indies in 1984, to win the opening match of this three-Test series.
But they could take heart from 21-year-old left-arm quick Rudra Pratap Singh who took five for 59, the first time he'd taken five wickets in a Test innings, in what was only his fifth match at this level and first outside the sub-continent.
Fellow left-arm seamer Zaheer Khan took four for 79.
Pietersen and Matt Prior put on 119 for the sixth-wicket before the wicket-keeper was out for 42.
England, having been rocked by Singh's pre-lunch burst of three for 10 in 15 balls, resumed on 161 for five with Pietersen 62 not out and Prior 10 not out.
Pietersen then took the attack to India's bowlers and went to 99 with two superb shots off Anil Kumble.
First he forced the veteran leg-spinner off the backfoot for four through extra-cover and next ball went down the pitch to drive him for a straight six.
Two balls later Pietersen had his century when he clipped Kumble through mid-wicket and diving fast bowler Shanthakumaram Sreesanth made a mess of trying to prevent the four on the boundary rope.
The South Africa-born batsman's ninth hundred in his 28 Tests, his third at Lord's, came off 148 balls with one six and 12 fours in three-and-a-half hours.
Pietersen, who in his newspaper column Sunday insisted his recent comments about player fatigue did not mean he wanted to miss an England game, received good support from Prior.
But just when it seemed the game was utterly beyond India's reach, Khan made a double breakthrough.
First he had Prior well caught by diving keeper Mahendra Singh Dhoni and next ball Chris Tremlett played on, the ball trickling onto his stumps as he became the fifth England player to make two noughts on Test debut.
Ryan Sidebottom survived the hat-trick with a solid forward defensive shot to a Khan yorker before he was caught by India captain Rahul Dravid, at slip, off Kumble.
Pietersen was bowled by Singh looking to hit out before the left-armer ended the innings by having Monty Panesar lbw.
England resumed Sunday on 77 for two after swing specialist James Anderson, in his first home Test since 2004 and in an attack missing the injured pace trio of Matthew Hoggard, Stephen Harmison and Andrew Flintoff, had taken a Test-best five for 42 and left-arm seamer Sidebottom four for 65.