Bryce Harper (2 for 5, two RBI) delivers a game-tying RBI single in the ninth inning before coming around to score the game-winner moments later on a grounder by Adam LaRoche. (Evan Vucci/Associated Press)

The slog of a baseball season, even for the best teams, presents countless invitations to just forget it, to slack, to conserve for another day. Thursday night, the Washington Nationals trailed by four runs in the seventh inning. They had already won their series against San Francisco. The pitcher who might start the All-Star Game opposed them. It seemed like a good time to start thinking about tomorrow.

But 19-year-olds tend only to think about today. Ian Desmond smashed a home run, a glimmer that Bryce Harper stretched into certainty. In the dugout, as Desmond circled the bases, Harper turned to Adam LaRoche. “We’re going to win this game,” Harper told him. “Just be ready for it.”

In the ninth inning, they were ready. Harper singled home the tying run, and then LaRoche scored him with a bases-loaded grounder to lift the Nationals to a 6-5 victory, their league-leading seventh walk-off win this season. When Brandon Belt could not scoop Brandon Crawford’s throw in the dirt to convert a double play, it eliminated extra innings and sent the Nationals to their fourth straight victory and a sweep of the team that entered this series with the second-best record in the National League.

With the woeful Colorado Rockies coming into town, the Nationals have built their winning streak with consecutive victories over Tim Hudson, Tim Lincecum, Madison Bumgarner and, Thursday night, Matt Cain. The Giants entered the series with a remarkable 74-1 record in the past 75 games in which they lead by at least three runs. On consecutive days, the Nationals have erased such a margin en route to two victories.

“We’re getting that sense that we’re never out of it,” LaRoche said. “Somebody new is going to come through every night.”

The Nationals and Giants wore throwback uniforms as a turn-back-the-clock tribute to the 1924 World Series, and the Nationals, 88 years later, again have the best record in their league. They have won seven of nine, and their latest victory nudged them to a season-high 16 games over .500. The surge has bumped their winning percentage to an even .600, another clue that points to the likelihood of meaningful October baseball in Washington for the first time since 1933.

In the past 10 seasons, 37 teams finished July 5 with a .595 winning percentage or better. Thirty-four of them would have made the postseason under the current playoff design, which for the first time includes a second wild card winner.

The 2005 Nationals, 51-32, were one of the three teams that would have tumbled out of the playoffs even under the new format. Those Nationals had scored the same number of runs as their opponents, a dooming predictive measure. These Nationals have outscored opponents by 60 runs.

“They had the front end of their rotation and we had the back end of ours, and we swept them,” said closer Tyler Clippard, who earned the win with a perfect ninth. “I doubt that there was too many doubts about what kind of club we had at this point in the season. But they know now not to doubt us.”

The final, furious rally began when Tyler Moore pinch-hit to lead off the ninth against Giants closer Santiago Casilla. The rookie clobbered a double to left-center field fence. Another rookie, Steve Lombardozzi, put down a perfect bunt that died between third base and the pitcher’s mound. Casilla scampered off the mound but could not collect the ball. Lombardozzi raced safely to first, and a Nationals victory began to feel inevitable.

Harper made sure. He lashed a 3-1, 95-mph fastball to right field, and Moore trotted home with the tying run. With runners on the corners and still no outs, Casilla intentionally walked Ryan Zimmerman to set up a force at home. Michael Morse obliged with a grounder to second that resulted in Lombardozzi getting thrown out by a step.

For a moment, it seemed the Giants might wriggle free. LaRoche chopped the first pitch he saw to second base, a double-play ball, and suddenly the game hung on LaRoche’s ability to get down the line.

“I know he’s not fast enough,” Zimmerman said he was thinking to himself. “Hopefully they mess it up.”

Second baseman Ryan Theriot fielded the ball on a high hop, spun and fired to second base. Brandon Crawford pinballed the ball to first. Harper crossed the plate and turned to first base.

“If he’s jumping up and down, then we won,” Harper said. “If he’s not, then it’s a tie ballgame and we’re going to extra innings.”

As LaRoche made his final lunge to the bag, he looked at Belt’s glove and saw the ball smack off its webbing and dribble away.

“I knew it was over,” LaRoche said. “I was running as fast as I can, which isn’t very fast.”

LaRoche raised his left fist, and then began a celebration unique to him, dreamed up by Gio Gonzalez on a team flight. A couple of teammates pretended to run around like deer, and LaRoche drew an imaginary bow and mimicked firing invisible arrows at them.

“You ever see a guy from Kansas who cares more about hunting than baseball?” Desmond asked.

The finish left the 29,819 at Nationals Park in a frenzy, but the wave really began in the seventh. The Nationals trailed after Ross Detwiler allowed three runs while dancing around 11 hits in five innings, many of them dinks and bleeders. Craig Stammen, who entered with a 1.41 ERA, allowed one run in each of the two innings he pitched.

Cain was cruising before Desmond broke the ice with a line drive over the scoreboard in right. Desmond had not hit an opposite-field home run in his career until last week in Colorado. Afterward, LaRoche told Desmond that, with his swing, half his homers should fly over the right-field fence.

Danny Espinosa followed with a blast to center off Cain that crept into the first row over the scoreboard. Cain had been nearly untouchable, and in a span of two batters the Nationals had chopped him down.

“We’re never out of it,” Clippard said. “It’s fifth inning or whatever and we’re sitting down there knowing we’re going to get back in this game. Whether we win it or not, I don’t know. But we’re going to back in this game.”

Mark DeRosa sent a double past Pablo Sandoval down the left-field line, and Lombardozzi followed with a line drive off reliever Jeremy Affeldt. Suddenly, walking to the plate as the go-ahead run was Harper.

On 2-1, Harper flared a fastball to left-center. The ball skipped a foot in front of Melky Cabrera, letting DeRosa trot home to make it 5-4.

“Kind of what this team has done all year,” Zimmerman said. “It’s fun to be a part of.”