England, set just 143 to win, reached their target for the loss of only one wicket with 33 balls left.
Opener Alex Hales was 47 not out, his unbroken second- wicket stand with Bairstow worth 98 runs. But the foundations for a victory which put England 1-0 up in this three-match series were laid by their bowlers.
They restricted South Africa to 142 for three after Proteas skipper AB de Villiers won the toss.
De Villiers made 65 not out and Farhaan Behardien an unbeaten 64 in an innings where fast bowler Mark Wood took two for 36.
But South Africa's total still looked short of a competitive score on what is usually a good batting pitch.
Spinners Liam Dawson (four overs for 17 runs) and debutant Mason Crane (four overs for 24) both bowled tidily on their Hampshire home ground.
- 'Lost our way' -
==================
"The result doesn't look good for us," de Villiers told Sky Sports.
"We lost our way at the start, had to rebuild and we were 20-30 runs short in the end," the star batsman added after a match where South Africa failed to get the boost they were looking for after their first-round exit at the Champions Trophy one-day international tournament.
"I'm trying to progress all the time and I played a few shots I didn't have a few months ago," said Test wicket-keeper Bairstow, whose fifty took just 29 balls.
England captain Eoin Morgan paid tribute to Dawson and Crane by saying: "Our spinners were impressive and never let AB and Farhaan get away from us.
"They managed to tie down one of the best players of our generation (de Villiers) and a very good international cricketer (Behardien)."
Left-arm paceman's Willey's had Jon-Jon Smuts out for a golden duck when he pushed forward tentatively and played on.
Wood then followed suit when Reeza Hendricks pulled his first ball to a leaping Willey at mid-wicket. Left-hander David Miller fell for nine when caught behind off Wood.
De Villiers, stepping well outside off stump, slog-swept Willey to complete a 49-ball fifty. Behardien pulled Wood for four for his fifty and next ball hit him straight back over his head for six but it was too little too late.
On Wednesday, he struck three sixes before, on 28, he was lbw to medium-pacer Andile Phehlukwayo after missing an extravagant reverse-sweep
Bairstow, however, kept the runs coming with sixes off leg-spinner Imran Tahir and debutant left-arm spinner Tabraiz Shamsi.
South Africa's day was summed up when Hales drove Tahir to long-on, only for Behardien to drop a routine catch with the ball going for four. Tahir's next delivery was smashed for six by Hales.
Disclaimer: No Business Standard Journalist was involved in creation of this content
