The Warriors held a nine-point lead heading into the game's final 100 seconds, but Atlanta threatened to come all the way back until Barnes came up with his key play on the backboard.
Golden State ended a two-game skid and dropped Atlanta below the .500 mark as the Hawks continued a four-game western trip that concludes on Friday in Sacramento.
A 3-pointer by Lou Williams brought Atlanta within 88-85 with 46 seconds remaining and if the Hawks could have made a defensive stop they would have had a chance to force overtime.
Atlanta let the clock run down before attempting a shot, which Stephen Curry did from 3-point range with 30 seconds left.
That shot failed to go, but Barnes was there to grab the vital rebound and he was soon fouled by Ivan Johnson. Barnes hit both free throws to give the Warriors a five-point cushion.
Williams made another 3-pointer, but two foul shots by Jarrett Jack with 10 seconds to play clinched the game for Golden State.
David Lee led the Warriors with 20 points and 10 rebounds. Barnes had 19 points and 13 boards. Williams paced the Hawks with 18 points off the bench.