South Africa were 18 for one in reply to England's first innings 353, a deficit of 335 runs.
Dean Elgar (eight) was out to what became the last ball before the interval when he was caught behind off Toby Roland-Jones to give the Middlesex seamer, one of three debutant in England's XI, his first Test wicket.
Earlier, Stokes made 112 against a South Africa attack missing the ill Vernon Philander.
Philander had enjoyed a superb return of two for 17 in 12 overs on yesterday's rain-marred first day and, if fully fit, would surely have relished the continued overcast conditions in what is the 100th Test staged at The Oval.
England had been criticised by several former captains for some slap-dash batting in a huge 340-run defeat by in the second Test at Trent Bridge that saw the Proteas level this four-match series at 1-1.
But Stokes got the balance right today by being aggressive against the old ball and watchful when the new one arrived before upping the tempo late on.
Cook fell soon afterwards for 88 when he was lbw on the back foot to fast bowler Morne Morkel.
Former captain Cook, already England's all-time leading Test run-scorer, moved past Australia great Allan Border into ninth place in the overall list during this near five-hour innings.
The 32-year-old opener hit 10 fours before falling in sight of what would have been his 31st Test century.
But fellow left-handed batsman Stokes, who made a Test- best 258 against South Africa at Cape Town last year, dismissively pulled Morkel for four.
Runs were flowing, with Stokes pulling fast bowler Kagiso Rabada -- banned from the second Test for swearing at the Durham all-rounder during England's series-opening win at Lord's -- to complete a 72-ball fifty with his seventh four.
But the new ball did the trick for the Proteas when Bairstow, on 36, edged a lifting Rabada delivery to second slip, where South Africa captain Faf du Plessis held a sharp catch to end a stand of 75.
Roland-Jones made a run-a-ball 25 that included a hooked six off the expensive Chris Morris (one for 91 in 17 overs) before he was lbw to Maharaj.
But the 26-year-old went to three figures in style with two sixes off successive Maharaj deliveries.
The first, a slog to long-on, was 'caught' by du Plessis but he touched the boundary rope as he fell, meaning Stokes had scored a six.
But the next ball sailed high into the stands as Stokes completed a 144-ball century.
New Zealand-born Stokes made it three sixes in a row by hoisting Maharaj over deep square leg.
He eventually holed out off Morkel, who took three for 70 in 28.2 overs.
Disclaimer: No Business Standard Journalist was involved in creation of this content
You’ve reached your limit of {{free_limit}} free articles this month.
Subscribe now for unlimited access.
Already subscribed? Log in
Subscribe to read the full story →
Smart Quarterly
₹900
3 Months
₹300/Month
Smart Essential
₹2,700
1 Year
₹225/Month
Super Saver
₹3,900
2 Years
₹162/Month
Renews automatically, cancel anytime
Here’s what’s included in our digital subscription plans
Exclusive premium stories online
Over 30 premium stories daily, handpicked by our editors


Complimentary Access to The New York Times
News, Games, Cooking, Audio, Wirecutter & The Athletic
Business Standard Epaper
Digital replica of our daily newspaper — with options to read, save, and share


Curated Newsletters
Insights on markets, finance, politics, tech, and more delivered to your inbox
Market Analysis & Investment Insights
In-depth market analysis & insights with access to The Smart Investor


Archives
Repository of articles and publications dating back to 1997
Ad-free Reading
Uninterrupted reading experience with no advertisements


Seamless Access Across All Devices
Access Business Standard across devices — mobile, tablet, or PC, via web or app
