Hagel gave Tampa Bay a 4-3 lead after beating Ilya Sorokin blocker side through a screen. He then completed the hat trick with an empty-net goal 21 seconds later for the 5-3 final.
Jake Guentzel scored twice for the Lightning (4-1-0), who won their fourth straight. Andrei Vasilevskiy made 20 saves.
Tony DeAngelo had a goal and an assist, and Matthew Schaefer and Brayden Schenn also scored for the Islanders (2-3-0), who have alternated wins and losses through their first five games. Sorokin made 21 saves.
Guentzel gave the Lightning a 1-0 lead at 5:45 of the first period. Jean-Gabriel Pageau turned the puck over along the right boards before Guentzel skated to the slot and beat Sorokin high blocker side.
Vasilevskiy got his blocker on a Horvat breakaway attempt at 11:14.
Hagel extended it to 2-0 at 15:42. Victor Hedman floated the puck through the neutral zone to Hagel, who cut right to left across the crease before he beat Sorokin high blocker side.
DeAngelo cut it to 2-1 at 6:27 of the second period. With Pageau screening Vasilevskiy, DeAngelo scored glove side from the point.
Guentzel’s power-play goal made it 3-1 at 7:54. Nikita Kucherov, stationed in the right dot, found Guentzel all alone in front.
Schaefer cut it to 3-2 at 11:41, beating a screened Vasilevskiy from the blue line. After evading trouble at the left point with a spin move, Schaefer skated to the middle of the ice before stopping and scoring.
Schenn tied it 3-3 on the power play at 19:53 after his redirect from the low slot banked off Cernak’s stick and passed Vasilevskiy’s right pad. Schaefer’s one-timer from the high slot was blocked, but Matias Maccelli jumped on the loose puck and fed Horvat deep in the right circle before his slap pass found Schenn in front.
Sorokin denied a Zemgus Girgensons backhand try at 7:52 of the third period to keep the game tied.
Vasilevskiy then got the tip of his left skate on an Anthony Duclair wraparound try at 12:02.