The score was tied 2-2 with 1:03 remaining when Brett Clark unleashed a shot that Capitals goalie Michal Neuvirth blocked. The rebound came straight to an unguarded Stamkos, who one-timed it home.
The two goals were the 57th and 58th of the season for the Lighting center.
Dwayne Roloson earned the victory with 31 stops for the Bolts, who have been eliminated from playoff contention.
Alexander Semin collected a goal and an assist for the Capitals, who retained a tenuous grip on the eighth and final playoff spot in the Eastern Conference despite the loss.
Washington holds a two-point lead over Buffalo with two games remaining, but the Sabres have a game in hand.
Jason Chimera also scored and Neuvirth finished with 23 saves for the Caps.