Bobby Finke pulled out his victory with a dazzling burst on the final lap.

Germany’s Florian Wellbrock snatched the lead from Italy’s Gregorio Paltrinieri on the final flip, with Finke lurking back in fourth.

But the American turned on the speed at the end of the 16-lap race, passing all three swimmers ahead of him to take the gold. Finke’s final 50 was 26.39 — nearly 2 seconds faster than anyone else.

“I had no idea I was going to do that,” Finke said. “I noticed with 10 meters off [the final turn] I was catching a little bit of ground, and that was the only motivation I needed.”

Finke’s winning time was 7 minutes, 41.87 seconds, just 0.24 ahead of Paltrinieri. Mykhailo Romanchuk of Ukraine touched in 7:42.33 to take the bronze, knocking Wellbrock back to fourth.

Over two swims, Finke knocked about 6 seconds off his personal best coming into the Olympics to walk away with a historic gold.

He wasn’t thinking about the pain until he touched the wall.

“Your mind just kind of disappears and you’re blocking it out at the end,” Finke said.

The men’s 800 freestyle was added to the Olympic program for these games, marking the first time that approximate distance was contested by the men since there was an 880-yard race at the 1904 St. Louis Games.