Charlie Hodgson had given them a 6-0 lead but Berrick Barnes restored parity by half-time and then added his third penalty to turn the game on its head.
But Barkley then took centre stage - levelling with 18 minutes remaining before holding his nerve twice in the final four minutes to earn England a morale-boosting win.
England flew out of the traps and went ahead after three minutes when Hodgson converted after Dan Ward-Smith's break down the wing.
Matt Banahan, David Strettle and Dominic Waldouck were impressive in the early stages and Hodgson had already missed his second attempt when he edged them further in front in the 13th minute.
Barnes was then introduced from the bench for the injured Will Chambers and his arrival inspired the hosts.
Ben McCalmon and Kurtley Beale then went close for Australia and their pressure was rewarded as Barnes got them level with two penalties.
The Waratahs star then missed a simple chance to give them the lead before the break after referee Steve Walsh advanced a penalty ten metres forward when Richard Wigglesworth refused to return the ball to Josh Valentine.
Johnson's men were second best at the start of the second period too and it was no surprise when Barnes moved the Barbarians in front with his third penalty on 51 minutes.
But England's scrum dominance came to the fore once again in the final quarter as Barkley took over from Hodgson in front of goal.
He drew the visitors level 18 minutes from time and proved to be the hero in the final four minutes to secure a relieving win for the tourists.