Yadiel Rivera's infield hit with none out in the 10th inning scored Brian Anderson, and the Miami Marlins beat the Tampa Bay Rays 3-2 on Monday night. 

Anderson walked against Ryne Stanek (1-2) to start the 10th and took third on a single by J.T. Realmuto. 

Rivera, who entered the game as a defensive replacement in the ninth, 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, but the play was ruled a hit.

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.

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.

Realmuto hit his 11th homer for 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. Tampa Bay's Nathan Eovaldi gave up two runs in six innings. 

Drew Rucinski (3-1) pitched a perfect 10th.

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: Attendance was 6,004.

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.

TRAINER'S ROOM

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.

UP NEXT

RHP Trevor Richards (2-5, 5.06) is expected to start Tuesday for the Marlins, with the Rays' starter to be announced.