Nashville scored five unanswered goals after trailing 3-0 late in the second period.
Stamkos tied the game 3-3 on the power play at 10:07 of the third period on a one-timer from below the left face-off circle off a cross-ice pass from Ryan O’Reilly, then gave the Predators a 4-3 lead at 18:47 by batting in O’Reilly’s pass in front.
Cole Smith added an empty-net goal at 19:33 to make it a 5-3 final.
O'Reilly had three assists, and Luke Evangelista had two assists for the Predators (24-22-4), who had lost their previous two. Juuse Saros made 23 saves.
Stephen Halliday scored his first NHL goal, and Jake Sanderson had two assists for the Senators (23-20-7), who had their five-game point streak end (3-0-2). James Reimer made 21 saves.
Halliday, playing his 19th NHL game, gave Ottawa a 1-0 lead at 6:03 of the first period when he jammed in the rebound of a shot by Lars Eller.
Ridly Greig made it 2-0 at 14:19. He took a pass up the middle from Michael Amadio, drove to the net and scored through the five-hole.
Dylan Cozens pushed the lead to 3-0 at 10:46 of the second, scoring in the slot with a redirection of a shot by Artem Zub.
Stamkos cut it to 3-1 at 18:34 with a power-play goal. He scored with a one-timer from the slot off a pass from Evangelista.
Jonathan Marchessault pulled the Predators within 3-2 at 8:19 of the third, finishing a give-and-go with Michael Bunting on a 2-on-0 rush.
Predators defenseman Roman Josi became the first player to play 1,000 games with Nashville.