Archer takes six wickets as England prevent ODI series whitewash in South Africa
Jos Buttler and Dawid Malan led the tourists' recovery after a poor start, with England setting a target of 347.
It appeared South Africa would once again respond – having produced a record chase in Bloemfontein – as Heinrich Klaasen hitting 80 from 62 balls.
However, Archer brought an end to his charge on his way to a maiden six-for in ODIs.
A woeful start for England saw Jason Roy (1), Ben Duckett (0) and Harry Brook (6) all dismissed by Lungi Ngidi inside the first six overs, leaving them 14-3.
The tourists recovered though, with Buttler (131) and Malan (118) sharing a stand of 232 for the fourth wicket.
Wicketkeeper Klaasen caught Malan after a stray shot straight up in the air but Moeen Ali (41) helped steer England past the 300 mark, before he and Buttler fell in quick succession.
South Africa's chase began well enough with an opening partnership of 49, but dangerous duo Temba Bavuma (35) and Rassie van der Dussen (5) were removed by Chris Woakes and Archer.
Beuran Hendricks (52) pushed the hosts into three figures before he was bowled by Adil Rashid, while Aiden Markram hit 39 from 35 balls to strengthen the hosts' response, but a looped hit was caught comfortably by Moeen off Archer's delivery, who also claimed David Miller for 13.
Klaasen hit seven fours and two sixes as he and Wayne Parnell kept South Africa in the hunt, combining for 85 before Archer and Ducket combined to dismiss Klaasen.
Rashid forced Sisanda Magala (2) to edge through the Buttler before Archer dismissed Parnell (34) and Tabraiz Shamsi (1) to take the next step on his comeback from injury and hand England victory.
England's big stand
Buttler and Malan's partnership led England's revival, with a total of 232 representing the fourth-biggest stand for England in ODIs and helping to set the highest ever ODI total in Kimberley.
The pair hit 26 boundaries combined, compared to the nine from England's seven other batters.
Archer's arm
Having made his return after a near two-year absence earlier in the series, Archer returned to his brilliant best in some style to finish with figures of 6-40, the third-best men's ODI bowling figures for an England player ever.
The dismissal of Klaasen was the most crucial, with the 31-year-old providing South Africa with momentum that abruptly disappeared once he departed.