The Nets overcame a six-point deficit in the closing 90 seconds of regulation and Johnson then made a jump shot with 18 seconds to go in the first overtime to forge a 100-100 tie.
Johnson made a free throw with 10 seconds left in the second overtime to give Brooklyn a two-point lead, but Kyle Singler offensive rebound and layup tied it with 5 seconds remaining.
That set up Johnson for his final shot of the evening, which came with a second to play. That gave him 28 points and boosted the Nets to their second straight victory.
Detroit appeared in control late in the fourth quarter, owning a 90-84 lead. Deron Williams then made a layup for the Nets, Gerald Wallace hit two free throws and Wallace tied it by scoring on an offensive rebound with 20 seconds to go.
Wallace had 25 points and 10 rebounds. Williams added 17 points.
Detroit, which lost its third in a row, was paced by Brandon Knight's 22 points.
2014: The Year in Music [PHOTOS]