Stephen Curry erupted for 40 points, sinking seven three-pointers, as the Golden State Warriors rallied from 22 down to defeat the Brooklyn Nets 121-119 on Thursday night.

The Warriors (35-28) trailed 27-5 early but stormed back, securing their fourth win in five games to close their road trip.

Jimmy Butler contributed 25 points and remained perfect from the free-throw line, hitting all 10 of his attempts. Golden State has gone 10-2 since acquiring Butler on Feb. 8.

Brooklyn (21-41) suffered its sixth consecutive loss despite a strong start, making 10 of its first 11 shots. Cam Johnson led the Nets with 26 points, while Cam Thomas added 23.

Curry’s most electrifying moment came just before halftime. With seconds left in the second quarter, he launched a turnaround heave from 38 feet that dropped in, cutting Brooklyn’s lead to five.

Gary Payton II had 16 points and nine rebounds for Golden State while wearing a protective mask after suffering a broken nose. However, the Warriors lost Brandin Podziemski after less than a minute due to lower back soreness.

Brooklyn struggled to contain Golden State’s stars, as Butler and Curry combined for more free throws (19) than the entire Nets team (18).

Draymond Green anchored the Warriors’ ball movement with 10 assists, while rookie Quinten Post added 10 points off the bench.

The Nets controlled much of the game but faltered in the final minutes. After leading by six with under five minutes remaining, they surrendered a late Warriors surge.