Denny Medley-USA TODAY Sports

MJ Melendez scored on a balk to complete a three-run 10th inning for the host Kansas City Royals, who beat the New York Mets 7-6 on Tuesday in a matchup of teams that made major moves earlier in the day before the trade deadline.

Francisco Alvarez hit a leadoff two-run homer in the 10th off Carlos Hernandez (1-6) before the Royals stormed back against a trio of Mets relievers.

Bobby Witt Jr.'s leadoff double off Brooks Raley (0-2) scored automatic runner Maikel Garcia before Witt scored on Melendez's single.

Dairon Blanco reached on a two-out throwing error by third baseman Brett Baty and Grant Hartwig walked Drew Waters -- pinch-hitting for Hernandez -- to load the bases.

Josh Walker entered, but he flinched while preparing to throw his first pitch, allowing Melendez to score.

The back-and-forth 10th inning capped a chaotic day and night for both clubs.

The Mets completed their trade deadline overhaul by dealing three players on Tuesday afternoon, a flurry of activity highlighted by a blockbuster in which New York sent three-time Cy Young Award winner Justin Verlander to the Houston Astros -- for whom he played the previous four-plus seasons -- for a pair of prospects.

New York traded Max Scherzer, another three-time Cy Young Award winner, to the Texas Rangers on Sunday.

The Royals sent closer Scott Barlow to the San Diego Padres on Tuesday for two minor league pitchers.

Once the game began just over two hours after the 6 p.m. ET deadline, the teams combined for two runs in the first six innings -- the Mets' Pete Alonso homered in the second and Garcia delivered a sacrifice fly in the fifth -- before swapping rallies in the later frames.

Blanco stole third base and scored on a throwing error by Alvarez in the seventh, when Garcia added a two-out RBI single.

Alonso's RBI single keyed a three-run rally by the Mets in the eighth, when they tied the score and took the lead on a bases-loaded walk by Baty and a sacrifice fly by Mark Vientos.

Melendez worked a leadoff walk in the bottom of the inning and eventually scored on a sacrifice fly by Freddy Fermin.

Royals starter Zack Greinke allowed one run on four hits and no walks while striking out three over five innings. The Mets' Jose Quintana gave up three runs on six hits and two walks while striking out two in 6 2/3 innings.

More must-reads:

TODAY'S BEST
Jaylen Brown, referees thwart Mavericks' comeback as Celtics take 3-0 series lead
NBA legend Jerry West dies at 86
Tom Brady's HOF speech provided closure for the Bill Belichick era
Why Caitlin Clark reminds Steve Kerr 'a lot' of Stephen Curry
Fernando Tatis Jr. looks like he finally has his swagger back
Tiger Woods to have interesting swing consultant at U.S. Open
Insider names the team to watch for Mitch Marner trade
Blue Jackets star forward reportedly requests trade
Watch: Luka Doncic fouls out amid Mavericks' failed comeback attempt vs. Celtics
Matt Turner redeems himself as USMNT holds Brazil to 1-1 draw
Joey Chestnut, Takeru Kobayashi to face off in hot dog eating competition on Netflix
Yankees confirm news on top prospect
Colts' Anthony Richardson has unusual take on NFL's level of difficulty
49ers' Christian McCaffrey addresses legend of 'Madden' curse after landing cover
Lionel Messi reveals whether he'll retire with Inter Miami CF
Browns' Myles Garrett using one thing as motivation for 2024 season
Vikings HC makes telling comments about Sam Darnold, J.J. McCarthy competition
Aaron Judge is the reason for the Yankees' new-look away uniforms
England's Gareth Southgate has blunt take on expectations at Euros
Broncos star WR doesn't rule out training-camp holdout

Want more MLB news?

Join the hundreds of thousands of fans who start their day with Yardbarker's Morning Bark, the best newsletter in sports.