Mired in a 1-for-27 slump that spanned seven games, Matthews was kept out of the lineup Monday for the first time since June 16.
But Matthews was back for the second game of the four-game series and hit a 2-0 pitch from Tampa Bay's latest closer, rookie Lee Gardner (0-1), over the right field fence.
Gardner came on to protect a 4-3 lead after Aubrey Huff put Tampa Bay ahead in the top of the ninth with his 17th homer.
Devil Rays manager Hal McRae called on Gardner after watching Esteban Yan fail to protect a pair of ninth-inning leads against Kansas City over the weekend.
Gardner retired Jay Gibbons, but pinch hitter Chris Richard reached on third baseman Jared Sandberg's error and took second on a single by Luis Lopez. Gardner walked Melvin Mora to load the bases and Jerry Hairston lifted a tying sacrifice fly before Matthews hit his seventh homer of the season.
Buddy Groom (3-2) got the final out in the top of the ninth for the win.
'Happy' fan videos make Pharrell cry [VIDEO]
Pistorius testifies he didn't consciously pull trigger when he shot girlfriend