The Nuggets managed to win their 14th consecutive game despite trailing by five points with a dozen seconds to play.
Brewer reignited Denver's hopes by making a 3-pointer with 11 seconds left and the Nuggets then sent Philadelphia's Evan Turner to the line.
Turner, however, missed both his foul shots and Brewer came down the court intent on attempting another 3-pointer. He missed it, but he was fouled by Damien Wilkins on the shot.
Brewer's three free throws put the Nuggets in front and they survived a missed 3-point attempt by Wilkins at the buzzer.
Brewer scored 29 points in a game that was close throughout, making 10-of-18 from the field. Andre Miller added 21 points and eight assists for the Nuggets, who moved within 2 1/2 games of Oklahoma City for the lead in the Northwest Division.
The 76ers, who have lost the opening two outings of a four-game road trip, were led by Wilkins with 24 points.