It was Stokes's major contribution on his return to the side four days after being cleared of affray.
Shastri had warned against ruling out an Indian comeback in the Test series while speaking to the media on Thursday.
India made three changes to the playing XI, handing young wicket-keeper batsman Rishabh Pant his maiden Test cap, while fit-again Jasprit Bumrah was back in the fold replacing Kuldeep Yadav and Shikhar Dhawan came in for Murali Vijay.
England were not quite at their best and ended up spending a full day in the field for the first time in the series. "From another point of view, it's a good situation to be in because you have no room for thinking about anything else apart from what the team requires at that particular moment from you throughout the Test".
Indian captain Virat Kohli on Friday took a dig at critics questioning his chop-and-change selection policy.
While the India top order showed some improvement against the moving ball, the visitors were still in danger of capitulating when Kohli was joined by Rahane.
The pair batted throughout the afternoon session when the ball stopped jagging around, compiling by far India's best partnership of the series until Rahane was snapped up after tea for 81 by Stuart Broad, courtesy of Alastair Cook's dazzling left-handed slip catch. Kohli kicking himself and gets OUT on 97.More news: Thousands stranded in India as deadly monsoon floods continue
More news: Nine planes grounded by bomb threats in South America: Chilean authorities
More news: Vengsarkar calls for Pant`s inclusion in 3rd Test
England's logic for bowling first was sound - the pitch had patches of furry grass, the early conditions were cloudy and they had a vulnerable batting line-up in their sights. The Indian captain had looked untroubled, over an hour into the final session, when Adil Rashid tossed a leg-break wide.
The third Test match will be played at the Trent Bridge, Nottingham.
The hosts, though, were blunted in the afternoon, with Stokes and Rashid disappointing. A stunning catch indeed! For India, here was a glimpse of what this tour to England was meant to be like.
Hardik Pandya fell at the stroke of stumps on Day 1, after having kept England's bowlers at bay following Kohli's dismissal.
Former England captain Michael Vaughan on Test Match Special: "It has been really good Test cricket". It's getting more and more hard for England to break this partnership.
Rahane believes India are satisfied with their effort, revealing the tourists would have opted to bat had they won the toss. They played their shots without the slightest hesitation, punishing England's bowlers when they strayed in line. I was looking to bowl wicket-to-wicket and mix my pace up. I've seen him in the IPL and he'll just come out and play. They've scored at a good rate too.
'But I don't feel the pressure of needing to be man of the match every game to keep my place, I just try to do my job, take wickets and score runs when I get the opportunity'. The third test could be the decider for India as this could be the last chance for the guests to get back to winning ways.