BALTIMORE — Rick Porcello pitched a four-hitter for his major league-high 21st victory, David Ortiz and Mookie Betts hit two-run homers and the Boston Red Sox beat the Baltimore Orioles 5-2 on Monday night to pad their lead in the AL East.

Coming off a four-game sweep of the Yankees, Boston sustained its late-season surge in the opener of an important four-game series for both clubs. The Red Sox stand atop the division by a season-high four games.

Adam Jones homered and Mark Trumbo picked up his 102nd RBI, but the Orioles dropped into a tie with Toronto for the first AL wild card.

Porcello (21-4) struck out seven and walked none in his third complete game of the year. Five days earlier against Baltimore, the right-hander gave up one run in eight innings but took the loss.

Playing his final regular season series in Baltimore, the 40-year-old Ortiz connected against rookie Dylan Bundy (9-6) with a man on in the fifth for a 5-1 lead.

DODGERS 2, GIANTS 1

LOS ANGELES — Adrian Gonzalez hit a game-ending double in the ninth inning, and Los Angeles rallied for a testy 2-1 victory over San Francisco that increased its NL West lead to six games.

Two innings after a shoving match broke out when tempers flared between Madison Bumgarner and Yasiel Puig again, the Dodgers’ comeback in the ninth began with pinch-hitter Andrew Toles’ leadoff single.

Corey Seager singled past diving second baseman Joe Panik on a two-strike pitch from Javier Lopez (1-3), allowing the speedy Toles to reach third.

Justin Turner’s single tied the game, and Gonzalez followed with a drive to deep right field that eluded Hunter Pence.

Joe Blanton (6-2) got the win in relief.

RANGERS 3, ANGELS 2

ARLINGTON, Texas — Ian Desmond had an RBI single with no outs in the ninth inning and Texas moved closer to the AL West title.

Elvis Andrus led off the ninth with a sharp single to left off Jose Alvarez (1-3) before Carlos Gomez turned an attempted sacrifice into a bunt single. Desmond, an All-Star center fielder, followed with his hit to right that scored Andrus.

Andrus also homered for the Rangers, who cut their magic number to three in pursuit of their second consecutive division title.

Alvarez, the sixth Angels pitcher, had gotten out of a bases-loaded jam in the eighth following a 38-minute rain delay.

Closer Sam Dyson (3-2) worked a scoreless ninth for the victory.

BLUE JAYS 3, MARINERS 2

SEATTLE — Marco Estrada took a no-hitter into the seventh inning, Edwin Encarnacion hit his 41st home run and Toronto beat Seattle in the opener of a critical three-game series.

Estrada (9-9) had allowed only two walks before Robinson Cano led off the seventh with a line drive up the middle on a 2-1 pitch. Cano and Nelson Cruz walked in the fourth inning, but Estrada otherwise kept the Mariners off the bases.

The Blue Jays pulled even with Baltimore for the first wild-card spot. Both teams are 2 ½ games clear of Detroit and three ahead of Seattle and Houston.

Taijuan Walker (6-11) allowed three runs in 5 1/3 innings.

Roberto Osuna got his 34th save.

CUBS 5, REDS 2

CHICAGO — Dexter Fowler hit a tiebreaking single with two outs in the seventh inning, and Chicago beat Cincinnati.

Fowler’s line drive into center field capped a three-run rally for the Cubs after they were shut down by Tim Adleman most of the night. It also made a winner of Jason Hammel (15-9), who pitched seven solid innings.

Jason Heyward added a two-run homer in the eighth as the Cubs moved seven games ahead of Washington for the best record in the National League, lowering their magic number for clinching home-field advantage throughout the NL playoffs to five. That’s the only major goal still out there during the regular season for major league-leading Chicago after it secured the NL Central title last week.

Blake Wood (6-4) allowed three runs in 1 2/3 innings.

BRAVES 7, METS 3

NEW YORK — Aaron Blair won for the first time in 13 major league starts, Freddie Freeman drove in three runs off a misfiring Noah Syndergaard and Atlanta slowed New York’s wild-card chase.

Freeman had four hits for the Braves, who have the worst record in the National League, and rookie Dansby Swanson had three hits and three RBIs.

New York had won 11 of its previous 14 games. The Mets have a one-game lead over San Francisco and St. Louis for the first NL wild card.

Pitching on five days’ rest rather than four, Syndergaard (13-9) allowed five runs, eight hits and three walks in 3 2/3 innings.

Blair (1-6) gave up six hits in six innings and lowered his ERA to 7.71.

CARDINALS 5, ROCKIES 3

DENVER — Carlos Martinez threw five effective innings and added a two-run double, helping St. Louis gain ground in the NL playoff race.

The Cardinals moved into a tie for the second wild card with the Giants.

Martinez, who turns 25 on Wednesday, gave himself an early birthday present by holding Colorado to two runs while striking out six. The right-hander is 9-1 on the road this season.

Martinez (15-8) helped his own cause with a two-out double as part of a three-run fourth. He also was hit just below the left leg by a fastball from Tyler Anderson (5-6) in the third — two pitches after Randal Grichuk lined a two-run homer.

ASTROS 4, ATHLETICS 2

OAKLAND, Calif. — Marwin Gonzalez hit a tiebreaking, two-run single off Ryan Madson in the ninth inning and Houston came from behind to beat Oakland.

The Astros trailed 2-1 going into the eighth but tied it on pinch-hitter Tyler White’s RBI double then scored twice in the ninth to bolster their slim playoff hopes.

Jose Altuve and Carlos Correa opened the inning with singles. After Evan Gattis was intentionally walked, Gonzalez lined the first pitch from Madson (5-7) into center field to drive in Altuve and Correa.

Former Oakland reliever Luke Gregerson (4-1) retired three batters for the win. Ken Giles pitched the ninth for his 12th save.

MARLINS 4, NATIONALS 3

MIAMI — Giancarlo Stanton homered and Miami beat Washington.

Christian Yelich, Ichiro Suzuki and Derek Dietrich also drove in a run for the Marlins and A.J. Ramos pitched the ninth for his 38th save in 41 chances.

Brian Ellington (3-2) picked up the win with an inning of relief while Mat Latos (7-3) took the loss.

ROYALS 8, WHITE SOX 3

KANSAS CITY, Mo. — Yordano Ventura picked up his first complete-game victory, Kendrys Morales hit a three-run homer and Kansas City defeated Chicago.

The Royals have won three straight, keeping their faint playoff hopes flickering with 12 games remaining. The Royals went 14-5 against the White Sox this year.

Ventura (11-11) gave up nine hits, struck out five and walked one. His only other complete game in the majors was a loss July 28 at Texas.

Morales homered off Carlos Rodon (7-10) in a four-run fifth. Morales homered in back-to-back games, bringing his total to 29. The last Royal to hit 30 home runs in a season was Jermaine Dye, with 33 in 2000.

PADRES 3, DIAMONDBACKS 2

SAN DIEGO — Clayton Richard was sharp for six-plus innings and Wil Myers homered as San Diego defeated Arizona.

Richard (3-3) won his third straight decision, charged with two runs and six hits. He struck out two and walked two. Brandon Maurer pitched the ninth for his 11th save in 13 chances.

Braden Shipley (4-4) was gone after four innings.