Michael Morse is greeted by Danny Espinosa after drilling his second home run Wednesday. Espinosa followed with a home run to give the Nationals their first back-to-back homers of the season in a 10-0 rout of the Cardinals. (Greg Fiume/Getty Images)

Washington Nationals Manager Jim Riggleman had laid out countless scenarios for lineups since before spring training. Recently, when the Nationals’ offense slipped to another level of impotence, he took two of his ideas and blended them into one. The moves — bumping the pitcher to eighth in the lineup and placing Jayson Werth in the leadoff spot — were meant to provide a last-ditch shove to the offense.

Whether or not the shuffle has been the source of the team’s recent surge, the Nationals have been jolted. In Wednesday’s 10-0 dismantling of the Cardinals at Nationals Park, Washington thoroughly exorcised two recent demons: an inconsistent offense and a lack of run support for starter Livan Hernandez.

Behind the booming bats of Michael Morse and Danny Espinosa, Hernandez turned in a dazzling performance, a three-hit, 105-pitch shutout, for the team’s fifth straight win — its longest such streak since the end of the 2009 season.

“It’s great,” said Hernandez, who notched the 50th complete game of his 16-year career. “We’re playing good now. We’re hitting good. We win five games and it’s what we’re doing. Everybody is working hard and try to win some games.”

The Nationals are 4-0 since moving Werth to the leadoff spot and bumping the pitcher to eighth in the lineup, and they have scored 18 runs in the past two games. Wednesday, Werth hit a solo home run in the eighth inning to cap the scoring. Ian Desmond, batting ninth, had two RBI. Hernandez, in the No. 8 spot, helped his own cause with a sacrifice bunt to move Ivan Rodriguez from second base to third in a three-run fourth inning and elicit a standing ovation from many of the 27,130 in attendance.

No player exemplifies the recent hitting surge more than Morse. The streaky slugger has blossomed into one of baseball’s hottest hitters, spraying balls across the field at a quickening pace. Morse, a towering 6-foot-5 player, has morphed from the starting left fielder at the start of the season into a vital, and nearly irreplaceable, presence at first base.

In the past month and a half, he has raised his batting average from .216 to .312. It was Morse’s 11th home run of the season in the second inning — the first of his three hits on the night — that gave the Nationals an early 1-0 lead.

“Hot streaks are usually ten days,” Riggleman said. “He’s just been real good ever since he’s been back in there. He was good throughout the spring with the exception of about a week where he cooled off. But this is much more than a hot streak.”

Hernandez, the sturdy 36-year-old at the heart of the Nationals’ astoundingly durable rotation, entered the game in a dry spell. Though not all because of his doing, Hernandez had not won a game since late April, a franchise-record drought of eight straight winless starts.

Of late, Hernandez had been the beneficiary of some lackluster run support. But on Wednesday, he received plenty of offensive help, though he was sharp enough to need only a little of it.

With well-placed fastballs, an effective sinker and slider, Hernandez (4-8, 3.77 ERA) cruised through the Cardinals’ lineup. He faced the minimum 12 batters and allowed one hit through four innings. Hernandez allowed his first extra-base hit in the fifth inning, a double by Jon Jay. “He was just kind of vintage Livo there,” Riggleman said.

“I feel good,” Hernandez said. “Like I say, I don’t know if I’m getting old but I got more energy, I think. I feel really good.”

In the seventh inning with a 6-0 lead, Morse again displayed his powerful stroke. He sent a 2-2 pitch from reliever Ryan Franklin several rows deep into the left field seats for his 12th home run, a two-run blast. Espinosa then slammed a home run into the right field seats — the first time the fraught Nationals offense had hit back-to-back homers this season. It was a much-need exclamation point to an offense that totaled 10 runs, 15 hits and 4 homers.

The first player to greet Espinosa in the dugout with a broad grin and fist-pump was Hernandez, glad that the Nationals had given him plenty of runs to work with and because they had seemingly found their groove.

After the game, Hernandez’s teammates honored him with a baseball tradition that, for some reason, he hadn’t experienced in his 16-year, 3,000-plus-inning career.

“What I can’t believe is that he never got pied in the face before,” Morse said. “I just heard that was the first time, so that was great.”