WASHINGTON -- Manny Machado's home run with two outs in the seventh inning won Wednesday night's game for the Baltimore Orioles.
His ninth inning at-bat provided just as much drama.
Machado hit a two-run go-ahead homer off Max Scherzer and then got hit by a pitch from Jonathan Papelbon in ninth as the Orioles rallied for a 4-3 victory over the Washington Nationals to move within four games of the final AL wild card spot.
With the Orioles leading 4-3, Papelbon's first pitch to Machado was up and in. Then his third pitch was a fastball that caught the Orioles third baseman on his upper arm.
"When you throw at somebody's head on purpose first pitch, straight out the get-go, then you throw a curveball, then you throw again at the head, that's just ... ," Machado said using a street term. "You know it's coward stuff. It's just coward."
Machado appeared to say something to Papelbon, but then went to first as home pla te umpire Mark Ripperger ejected the protesting pitcher.
"They just said they deemed it intentional, and they didn't give me any reason," Papelbon said. "I don't know if they have to give me any reason or not, but perception is reality.
"If Manny thinks I hit him, then that's what he thinks. I'm not going to sit here and go back forth whether I did or whether I didn't, because it doesn't matter. If he thinks I did, that's what he thinks."
Orioles manager Buck Showalter said of Papelbon: "He kind of reminds me of the wrestlers who pull somebody's hair and then they throw their hands up."
Washington's Bryce Harper was already looking ahead to Thursday's series finale.
"I mean Manny freaking hit a homer," Harper said. "Walked it off and somebody drilled him. I mean, it's pretty tired. It's one of those situations where it happens and, I don't know, I'll probably get drilled tomorrow."
Steve Pearce had a two-run homer and a double for the Orioles.
Washington remains 6 1-2 games behind NL-East leading New York, which lost to Atlanta.
J.J. Hardy led off the seventh with a double against Scherzer (12-12). With two outs Machado lined Scherzer's season-high 122nd and final pitch into the seats in left center for his 30th homer.
"I finally got a good pitch to hit and I drove it," Machado said. "I think it's been the hardest ball I've hit all year. One of my hardest home runs."
Baltimore starter Chris Tillman (10-11) allowed three runs over six innings for his first win since Aug. 17.
Reliever Mychal Givens chipped in two scoreless innings and Darren O'Day pitched the ninth for his fifth save.
Scherzer gave up four earned runs and seven hits while striking out 12 and walking two.
He has 249 strikeouts on the season, and set a Nationals (2005-present) record, surpassing Stephen Strasburg's 242 in 2014.
Scherzer has allowed 14 homers in his last nine starts.
Machado was nearly ejected in the fifth inning after Ripperger declined to grant him time and Scherzer's pitch was a called strike three.
Showalter came out and steered Machado away from Ripperger.
The Nationals rallied for a 3-2 lead in the fifth.
Tillman had retired 12 straight before issuing a one-out walk to Michael Taylor, and Taylor scored when Wilson Ramos followed with a double.
Ramos went to third on a single by Scherzer and scored on Anthony Rendon's sacrifice fly.
The Orioles took a 2-0 lead in the first. Chris Davis drew a two-out walk and Pearce followed with his 14th home run.
Washington pulled with 2-1 in their half on Yunel Escobar's RBI single.
Orioles: CF Adam Jones (back spasms) missed his second straight game. ... RHP Miguel Gonzalez (right shoulder tendinitis) threw a three-inning simulated game as well as a 20-pitch bullpen session, and is expected to throw another bullpen session Saturday.
Nationals: 1B Ryan Zimmerman (oblique) has been taking light swings, but remains day-to-day. "When he goes out there and plays we want him to be able to let it go, so he's got to get to that point first," manager Matt Williams said.
Baltimore RHP Tyler Wilson (2-2, 3.72) pitches the series finale, making his second start since being recalled from Triple-A Norfolk. Wilson allowed six runs in 4 1-3 innings of a loss to Tampa Bay last Friday. He will be opposed by RHP Tanner Roark (4-6, 4.73), who lost his last two starts, both against the Marlins.
Scherzer was seeking his first win at Nationals Park since he no-hit the Pirates on June 20.
After Baltimore's Gerardo Parra appeared to injure himself on a swing, Showalter came out to check on him. "Shoulder," Showalter said. "I told him if he quit swinging and missing it wouldn't hurt so much." Parra remained in the game.
Copyright 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.