No. 9 hitter Javier Baez hit his second go-ahead, three-run homer of the game in the bottom of the 11th inning to lead Detroit over Boston.

The AL-leading Tigers were ahead in the first, third, fourth and sixth innings and lost the lead each time.

After falling behind in each of the two extra innings, they came back to win a second straight game against Boston and 10th in 13 games.

Kristian Campbell hit a two-run homer in the 11th for the Red Sox, but Greg Weissert (1-1) failed to keep a two-run lead. He allowed Jace Jung to hit a leadoff single and Baez to turn on a no-doubt shot to left.

Baez, who has revived his career this season after struggling the previous three seasons in Detroit, also had a three-run homer in the sixth for a 6-4 lead.

David Hamilton’s two-run blast off Tommy Kahnle pulled the Red Sox into a 6-all tie in the eighth.

Boston’s Alex Bregman hit a solo hom er in the fourth.

Mets 2, Pirates 1: Brett Baty hit a tiebreaking homer in the seventh and host New York held off Pittsburgh.

Brandon Nimmo had an early RBI double off hard-luck loser Mitch Keller for the NL East-leading Mets (28-15), who have won five of six to move a season-best 13 games over .500. They are now 17-4 at Citi Field.

Keller (1-5) allowed just two runs and five hits in seven innings, but lost his fifth consecutive decision. He struck out eight and walked one.

The last-place Pirates failed to score more than four runs for the 19th straight game, a franchise record since at least 1901.

Mets starter Kodai Senga allowed one run, six hits and struck out seven in 5 2/3 innings.

Braves 5, Nationals 2: Drake Baldwin hit a two-run homer, Spencer Schwellenbach pitched seven strong innings and Atlanta improved to .500 for the first time this season with a home win over Washington.

The Braves (21-21), who began the season 0-7, handed the Nationals their seventh straight loss.

Baldwin was 3 for 4 with two RBIs and three runs scored.

Atlanta native CJ Abrams homered on the first pitch of the game from Schwellenbach (2-3), who kept the Nationals in check from there. He gave up two runs, four hits and two walks.

Rangers 4, Rockies 1: Josh Jung hit a first-inning three-run homer and an eighth-inning solo shot while Jack Leiter allowed only one run on two singles over six innings as host Texas beat struggling Colorado.

Jung’s first homer followed singles by Sam Haggerty and Wyatt Langford for the Rangers (22-21), who have won four consecutive games to move above .500 for the first time since April 30.

Leiter (3-2) didn’t allow a hit after two of the first four Rockies singled, Hunter Goodman scoring Jordan Beck. He won for the first time since April 2.

Kyle Freeland (0-6) gave up three runs on his first five pitches for the Rockies (7-35), who have the worst record through 42 games of the divisional era (beginning in 1961). They’ve lost their first two games under interim manager Warren Schaeffer, who took over Sunday evening following the firing of Bud Black.

Colorado fell to 2-19 on the road.

Astros 2, Royals 1: Isaac Paredes hit a tiebreaking solo homer off John Schreiber in the bottom of the ninth inning to lift Houston over Kansas City.

The game was tied at 1 after a home run by the Astros’ Jeremy Peña in the sixth inning.

Houston’s Framber Valdez allowed six hits and a run with seven strikeouts in eight innings. Kris Bubic yielded six hits and a run and tied a career high with nine strikeouts in 6 1/3 innings.

Cubs 5, Marlins 4: Nico Hoerner had an RBI single and Justin Turner followed with a two-run double, all in the ninth inning, as NL Central-leading Chicago rallied to edge Miami at Wrigley Field.

Kyle Stowers hit a solo homer in the second and Connor Norby went deep in the seventh for the Marlins.

Rays 11, Blue Jays 9: Junior Caminero hit a tiebreaking grand slam during a five-run top of the ninth inning, Danny Jansen homered against his former team, and Tampa Bay topped Toronto.

Daulton Varsho homered twice for the Blue Jays, and his three-run shot in the eighth against Edwin Uceta (3-1) put Toronto ahead 7-6. After Chandler Simpson’s RBI single and Caminero’s 419-foot shot to the upper deck in left made it 11-7 in the ninth, the Rays survived run-scoring doubles by Bo Bichette and Vladimir Guerrero Jr. in the bottom half.

Jeff Hoffman (3-2) gave up Caminero’s eighth homer this season and blew his second save.

Guardians 2, Brewers 0: José Ramírez hit his seventh homer, Logan Allen allowed three hits in six innings, and Cleveland posted its second consecutive shutout of visiting Milwaukee.

Kyle Manzardo drove in the Guardians’ other run with a triple.

Allen (2-2) walked one and struck out six.

The Guardians have six shutouts this season, including Monday night’s 5-0 win over the Brewers.

Ramírez went deep in the first inning off Quinn Priester (1-2), who allowed three hits in five innings.

White Sox 5, Reds 1 (10): Miguel Vargas hit a three-run homer in the 10th and Chicago won at Cincinnati.

The Reds’ Elly De La Cruz hit a 435-foot solo homer, his seventh, to tie the game in the bottom of the ninth.

Chase Meidroth gave the White Sox the lead again with his RBI single before Vargas connected on the next pitch from Emilio Pagán (0-2) for his third homer.

Chicago’s Jonathan Can- non threw six scoreless inn- ings, giving up four hits, no walks and striking out six.

Reds starter Andrew Abbott went six innings, giving up one run on four hits with no walks and seven strikeouts.