MIAMI (AP) J.T. Realmuto had another big game before another small crowd, which probably didn't help his cause much in the All-Star voting.
Realmuto has 11 home runs and is batting .311 but ranks a distant fifth in NL All-Star fan voting.
''He's a great player,'' manager Don Mattingly said before the game. ''People just don't know it yet.''
There weren't many at Marlins Park to spread the word. Attendance was 6,004.
Brian Anderson walked against Ryne Stanek (1-2) to start the 10th and took third on Realmuto's single. Yadiel Rivera followed with an RBI infield single.
Realmuto, hoping for his first All-Star appearance, said he has no hard feelings regarding the voting.
''We don't have as many fans as other teams have,'' he said. ''That's how the fan vote goes. All I can do is go out there and play and let my numbers do the talking for me.''
The Rays lost for only the second time in 10 games, and allowed more than two runs for the first time in seven games, ending a franchise-record streak. Tampa Bay has lost 21 one-run games, most in the majors.
Realmuto's solo homer put Miami ahead 2-1. The Rays' C.J. Cron tied the game in the ninth with a two-out RBI double against closer Kyle Barraclough, who hadn't given up a run since May 8 .
Miami had runners at the corners in the 10th with none out when Rivera pulled a one-hopper up the line . Third baseman Matt Duffy backhanded the ball and double-clutched in foul territory before making a wild throw home, with the play ruled a hit.
''I tried to make a desperation play,'' Duffy said. ''I didn't get a grip and tried to rush the transfer.''
Rivera, a reserve batting .198, entered the game in the ninth as a defensive replacement and came through with his second walk-off hit this season.
''We go home happy,'' he said. ''That's the best part.''
Miami second baseman Starlin Castro tied a career high with four hits but also committed an error that led to an unearned run. Miguel Rojas had three hits, including a two-out RBI double in the second.
The Marlins' Wei-Yin Chen allowed one run in six innings and it was unearned, lowering his ERA to 5.55.
''Today was a tough one,'' Rays manager Kevin Cash said. ''We didn't have our best approach against Chen for whatever reason, but you look past that and figure that we tied the game off a really good pitcher in Barraclough.''
Tampa Bay's Nathan Eovaldi gave up two runs in six innings. Drew Rucinski (3-1) pitched a perfect 10th for Miami.
On a clear, 86-degree night, the retractable roof was open for the 17th time this year, extending the franchise record. Marlins owner Derek Jeter watched from the second row and had plenty of elbow room.
BREAKTHROUGH AGAINST BARRACLOUGH
The Rays trailed 2-1 to start the ninth but rallied against Barraclough, who entered the game with a streak of 20 2/3 consecutive scoreless innings.
Daniel Robertson led off with a single, and following a flyout and a forceout, Jake Bauers slid home from first on Cron's double, barely beating the throw from left field.
Marlins RHP Drew Steckenrider was hit in the lower right leg by Cron's comebacker in the seventh but stayed in the game and pitched a scoreless inning, and said afterward he was fine.
RHP Trevor Richards (2-5, 5.06) is expected to start Tuesday for the Marlins against LHP Brian Yarbrough (7-4, 3.76).
More AP baseball: https://apnews.com/tag/MLBbaseball
Copyright 2018 by AP. Any commercial use or distribution without the express written consent of AP is strictly prohibited.