Gerardo Parra had tried everything. He wanted to change his walk-up music, but the genres he tested before Wednesday’s game — merengue, reggaeton, hip-hop — didn’t feel right. Then he thought of his 2-year-old daughter, Aaliyah, and her favorite song.

When the Washington Nationals outfielder came to the plate for the first game of a doubleheader against the Philadelphia Phillies, what wafted through the Nationals Park speakers was the chorus of a maddening children’s anthem called “Baby Shark.”

“She sings it a lot,” Parra laughed later.

The music changed the game. In his first at-bat, Parra grounded out, but later he delivered an RBI double that put his team ahead, threw out Bryce Harper at third base to help keep the Nationals in front and smashed a solo home run off the railing of the second deck in right field to punctuate a 6-2, series-opening win.

The victory at last began a week that looks crucial to the Nationals’ aspirations of climbing back into the National League East race. It was easy to forget, given the circumstances of the past few days — rainouts Monday and Tuesday night, the news that ace Max Scherzer broke his nose bunting in batting practice Tuesday but still started Wednesday night’s second game , the sparsely filled seats for this day game on a thickly humid afternoon — but underneath it all, this series against the second-place Phillies remains pivotal.

With the win, the fourth-place Nationals moved within eight games of the first-place Atlanta Braves and five of the Phillies. By the end of the day, those deficits could be seven and four.

“The last couple days have been pretty frustrating, not being able to play,” starter Patrick Corbin said. “It’s good to just come in, see some good weather and face these guys.”

Corbin would’ve had an alibi Wednesday if he had struggled as he had in his previous three outings, when he allowed 20 runs (16 earned) in 12⅔ innings. The left-hander had shown up expecting to pitch each of the previous two nights, but then he sat and waited. At one point, he felt convinced he wouldn’t appear in this series at all and asked the scouting department to prepare a report on the Braves, who visit the Nationals for three games starting Friday.

Yet when he finally toed the rubber Wednesday, Corbin shined. He bounced back with his best start since a May 25 shutout of Miami. In seven innings, he allowed one run on four hits and three walks while striking out eight. He threw up in the strike zone, changed the hitters’ eye levels and maintained a “good mix” of breaking balls, he said.

“We followed Corbin’s heartbeat,” Manager Dave Martinez said. “Man, he was jacked up.”

After his recent struggles, the 29-year-old seemed more willing to throw his slider in the strike zone. It burned him once — in the first, when he missed over the plate and the Phillies’ Scott Kingery hit a towering home run into the Nationals’ bullpen — but the pitcher and his manager pointed to improved location for improved results for the rest of the afternoon. In one stretch from the second through the fourth innings, Corbin struck out seven of eight batters — four with his slider and three with his fastball.

“I was able to make quicker adjustments today on some fastballs and get back into the zone,” he said. “The couple that I did miss with, I felt it right away and was able to get back on line.”

The lineup made Corbin’s strong outing stand up. Juan Soto erased Corbin’s mistake with an RBI single in the first and, in the fourth, Parra gave him the lead with a two-out double. In the sixth, Corbin jumped ahead of Harper in the count 0-2 but walked him. The next hitter, Kingery, scorched a ball up the middle for a single, and it briefly appeared Corbin’s promising start might unravel when Harper rounded second and sped for third.

Parra, in center field, knew Harper would be aggressive, so he barehanded the ball and fired it to third baseman Anthony Rendon, who slapped the tag on Harper just in time. If Harper had made it to third, this game might’ve ended differently, but instead, Corbin pitched around the single he allowed to the next batter, Rhys Hoskins, and escaped unscathed.

“That changed the game,” Parra said.

In the dugout afterward, Parra joked with Martinez — remarkably similar to Parra as a defense-first outfielder in his playing days — that he couldn’t have made a play like that.

“I go, ‘Too bad; I got videos of all of them,’ ” Martinez joked back.

In the bottom of the sixth, Brian Dozier continued heating up with an RBI double. In the eighth, he expanded the Nationals’ lead again, this time to 5-1, with a two-run homer to left. Still, Martinez kept closer Sean Doolittle warming in the bullpen.

Just then, the speakers blared the “doo doo doo doo doo doo doo” of “Baby Shark,” and Parra delivered again. His home run gave the Nationals another insurance run, and Martinez had his closer take a seat. The manager could save his most valuable reliever for the second game of the day, just in case.