WASHINGTON — Bryce Harper was money for the Washington Nationals on Saturday night.

Fresh from getting a big deal, Harper hit a game-ending home run with two outs in the ninth inning that sent the Nationals over the Philadelphia Phillies 6-4.

Hours before the game, the Nationals announced they had reached agreement with Harper on a $21,625,000 contract for the 2018 season, covering the slugging outfielder through his last year before he can become a free agent. Harper would've been eligible for salary arbitration next year.

"Nobody can say he ain't worth the money," manager Dusty Baker said after watching Harper's heroics.

On the day the deal was announced, the 24-year-old star provided an immediate payoff. Pinch hitter Adam Lind led off with a single against Edubray Ramos (0-3) and two outs later, Harper lined an 0-1 pitch over the wall in centre for his 11th homer of the season.

"I tried to go John Wall," Harper said, referencing the Washington Wizards guard whose late 3-pointer lifted his team over the Boston Celtics in a playoff game Friday night. "Walk 'em off a little bit.

"I know nobody wanted to play extras with a doubleheader ahead of us tomorrow. So, a huge win tonight."

It was Harper's second walk-off homer of the season and the fifth of his career.

"You have to want to be the man in that situation," Baker said.

Phillies manager Pete Mackanin, whose team squandered a four-run lead, said he didn't even think about pitching around Harper with Ryan Zimmerman on deck.

"He was looking for a heater out over the plate that he can get," Mackanin said. "(Ramos) missed his spot; it was pretty much down the middle, above the knees."

Trailing 4-0 in the fifth, Washington tied it on a two-run homer by Trea Turner and a two-run double by Zimmerman.

Shawn Kelley (3-0) pitched the ninth.

Washington relievers threw 4 1/3 scoreless innings, helping send the Phillies to their eighth loss in nine games.

Nick Pivetta made his third career start and second against the team that sent him to Phillies for Jonathan Papelbon and cash in 2015. He gave up four runs on five hits over 4 2/3 innings.

Washington starter Tanner Roark allowed four runs on six hits in 4 2/3 innings.

TRAINER'S ROOM

Phillies: RHP Aaron Nola (lower back strain) will make a second rehab start on Monday with the Triple-A Lehigh Valley IronPigs.

Nationals: OF Jayson Werth left after seven innings. "He was having some tightness in his groin," Baker said after the game "(From) when he went to break up that double play at second base. So we took him out of the game, it was a cold night and you're always fearful on nights like this of guys having some leg problems."

WE SHOULD SEE OTHER PEOPLE

Weather permitting, at the close of Sunday the Phillies will have played 12 of their first 35 games of the season against the slugging Nationals. "When you're facing teams of this calibre like the Nationals, that wasn't a good draw on our part," Mackanin said. After Sunday, the teams don't meet again until Sept. 7. Philadelphia is 4-6 so far against Washington.

COMFORT ZONE

Baker on Harper agreeing to a contract for 2018: "We always like to know where we are, where we're going. I think everybody likes to be comfortable, not to have to wonder what's in their future. And not only is he comfortable, he's very comfortable."

UP NEXT

Phillies: RHP Jeremy Hellickson (4-1, 3.49 ERA) faces the Nationals for the fourth time this season in the first game of Sunday's split doubleheader. He's 1-0 with a 2.70 ERA against them in 2017, and 2-3, with a 4.86 ERA lifetime.

Nationals: LHP Gio Gonzalez (3-1, 2.64) has allowed two earned runs or fewer in each of his last six home starts against the Phillies, a streak that dates to July 2014.

___

More AP baseball: https://apnews.com/tag/MLBbaseball