MIAMI — The first half of the Washington Nationals’ season came to end here Sunday afternoon, and the players, coaches and front office were left with four days to digest the reality: The Nationals are a talented team that nonetheless has plenty of ground to make up after months of mediocre play.

They avoided a three-game sweep at the hands of the lowly Miami Marlins with a 5-2 win thanks to a 10th-inning offensive explosion. Washington finished a seven-game trip leading into the all-star break with only two victories, but the final one helped them avoid falling under .500. For an underperforming team’s psyche, it’s best to rest with a victory as the last memory.

“We’re not where we want to be,” reliever Tyler Clippard said. “We’ve just been grinding. Every day it’s been a battle. That’s part of the baseball season. We expected that. We obviously expected to play better than we have, but we’re still within arm’s distance of where we want to be, and it’s going to be good to kind of go home, reset the batteries for the break and come back and get the ball rolling on a positive note for the second half.”

The Nationals’ winning rally was keyed by a scuffling player who wanted, perhaps more than anyone, to end the first half of the season on a positive note. Manager Davey Johnson moved Denard Span into the seventh spot of the lineupSunday for the first time. With Ian Desmond on first and two outs in the 10th, Span provided the tiebreaking double to center off Steve Cishek. A single by Wilson Ramos and double by pinch-hitter Chad Tracy tacked on two more runs, and the Nationals (48-47) could finally cruise to the first-half finish line.

“I couldn’t play any worse than I have this first half,” said Span, who went 3 for 5 with two RBI in his new spot. “I wanted to go out feeling good and go home feeling good. I didn’t want to go home feeling in more of a stale mood than I’m already in.”

The Post Sports Live crew debates whether Bryce Harper will have a more exciting appearance in the MLB All-Star Game or in the Home Run Derby. (Post Sports Live)

In some ways, the Nationals have been lucky. Their run differential says they should have a worse record. Injuries have exposed their underperforming depth. Yet they are a reachable six games behind the National League East-leading Atlanta Braves. To get to 90 wins, the plateau historically needed to reach the postseason under the wild-card format, the Nationals would have to go 42-25 in the second half, a .627 winning percentage. The Nationals have dug themselves a hole but not a grave.

“I like what I saw [Sunday], and I like this ballclub,” Johnson said. “We’ve had a few hiccups with injuries and whatever, but I think we’re in good shape going into the second half. We’re an awfully good ballclub, and we just need to play like it. Offense [on Sunday], the way everybody in the lineup swung the bat, that was huge for us.”

The ongoing frustration with his team’s offense was such that Johnson couldn’t wait until after the all-star break to overhaul the lineup. He moved down Span. He placed Bryce Harper and Anthony Rendon, two of the team’s best hitters, atop the lineup because of their high on-base percentages. The drastic changes, for one game at least, helped spark the Nationals.

Span, starting at a spot other than leadoff for the first time in two years, drove in the game’s first run when he doubled home Adam LaRoche in the second inning. The Harper-Rendon pairing provided the tying run in the seventh inning when Harper drew a two-out walk and Rendon scorched a double to left.

The offense still had large lapses, stranding 11 base runners. It also failed to score a run in an inning that featured four hits. With his team ahead 1-0 in the fourth, Jayson Werth drilled a single to right field. The ball squirted under the glove of a diving Giancarlo Stanton. Werth took off for second, and Stanton, from his knees, threw him out.

Ian Desmond then singled, and Span followed with another hit. With two outs, starting pitcher Taylor Jordan singled softly to right. Desmond rounded third base, and coach Trent Jewett waved him home. Stanton fired a dart to catcher Jeff Mathis, whose left foot blocked Desmond’s slide into the plate. If Desmond had been held, Harper would have batted with the bases loaded. Johnson, however, was undeterred.

“We don’t have many opportunities to do that, so any time we get a guy who has a chance to score, I don’t care if he’s thrown out,” he said. “We’re going to try to score.”

Despite some hiccups, Johnson said players told him they were pleased with the new lineup.

“I loved it,” said Harper, who had never before hit leadoff in the majors. “I really did. I thought just getting in there and getting the ABs that I did . . . I got six ABs today. That’s awesome. That’s all I can say. I liked doing it. I did it in high school. So that’s great. If he left me there, I’d be absolutely comfortable.”

Jordan, in his fourth and possibly final start as an injury replacement for Ross Detwiler and Dan Haren, threw six innings for the first time since his call-up. The rookie allowed eight hits, many of them soft singles. His most glaring mistake was a two-run homer to Derek Dietrich in the fourth inning, only the second homer he has allowed in 112 innings across the minors and majors.

Although the all-star break is an arbitrary mark of the season — the midpoint of the 162-game season was two weeks ago — it’s a chance for the Nationals to rest. Harper will participate in Monday’s Home Run Derby and start in Tuesday’s All-Star Game, with teammate Jordan Zimmermann in attendance but not playing because of a neck injury. The rest of the team will head home or take a short vacation. They will all return to Washington by Friday to resume their quest for a playoff berth, hoping to erase months of self-inflicted damage.

Comments our editors find particularly useful or relevant are displayed in Top Comments, as are comments by users with these badges: . Replies to those posts appear here, as well as posts by staff writers.

To pause and restart automatic updates, click "Live" or "Paused". If paused, you'll be notified of the number of additional comments that have come in.

Comments our editors find particularly useful or relevant are displayed in Top Comments, as are comments by users with these badges: . Replies to those posts appear here, as well as posts by staff writers.