Juan Soto waves to the crowd after his three-run home run in eighth inning pushed the Nationals ahead in a 12-10 win over the Marlins. (John McDonnell/The Washington Post)

The Washington Nationals hardly deserved to win this game. Four errors did not account for all their fielding mistakes. The bullpen wasted two comebacks. They were five outs away from falling to the Miami Marlins, a team all but trying to lose this season, and would have only dipped deeper into an early-season abyss.

Then Juan Soto crouched into the batter’s box, lifted a baseball high above Nationals Park and was rounding first when it landed in the red seats beyond the wall in left-center field. The Nationals got by on that hit, 12-10 over the Marlins, and snapped a five-game losing streak along the way. Matt Adams rocketed a solo shot to right one batter later off Tayron Guerrero in that decisive eighth inning. The cushion was even bullpen-proof.

Sean Doolittle gave up a homer in the ninth, teasing another bullpen implosion, but recovered for a rocky save that squeezed Washington back into the win column. But that didn’t mean Manager Dave Martinez was pleased with the overall effort. He was, as it turned out, still pretty ticked off.

“We have to play clean baseball,” Martinez said, punctuating each of the words as if they were full sentences on their own. “I know I sound like a broken record, but we have to. If we’re going to come back and do the things we want to do, we have to play clean baseball.

“Hey, I can tell you right now, if I was a fan, I’m frustrated. I am.”

It was a few hours before first pitch, and six or so hours before Soto’s clutch home run, that General Manager Mike Rizzo stood by the Nationals’ dugout surrounded by television cameras and reporters.

This season, through 51 games, has been like none of his other 12 with the franchise. Never had a built-to-win team been this far below expectations at this early of a stage. Never had Rizzo had this many decisions go wrong at the same time, even if there’s still some chance for Brian Dozier, Yan Gomes, Aníbal Sánchez, Kyle Barraclough, Jeremy Hellickson and — wait for it — Trevor Rosenthal to improve.

Rizzo doesn’t speak to a full group often, only changing course when there is a notable transaction, there is a costly injury or something is going wrong. So he spoke Friday, with the season slipping out of Washington’s control, with a small crowd waiting for him as he walked over from the on-field batting cage. He had a smile on his face, his eyes hidden behind dark sunglasses, his public face not reflecting the disappointment of a 19-31 start. The afternoon sun reflected off his bald head, and, after waiting a few beats for a question, he was asked who should shoulder the blame.

“There’s plenty of blame to go around,” Rizzo said. “We’re playing poorly. Believe me, I’m like a lot of the fan base, a lot of the players and the manager. It’s hard to watch sometimes. But we’re certainly not going to pull the plug before we’re a third of the way through the season.”

Pulling the plug, heading into Friday, could have meant firing Martinez after the Nationals were swept out of a four-game series by the New York Mets this week. It could, in a few months, mean selling key players with the future in mind. But Rizzo pushed aside both possibilities, pointing again to the calendar and dampening speculation that Martinez could soon be gone.

“We’re not making any decisions with a third of the season gone. We’ve got a lot of season left,” Rizzo said when asked, directly, what his confidence level is with Martinez. “Davey’s not happy with what’s going on. Nobody’s happy with what’s going on, the fan base, ownership and myself. Things got to get better. We’ve got to play better baseball.”

So that was the directive Friday, a task that’s been too much for these Nationals to handle. And better baseball did not start right away. Kyle McGowin, making the second start of his career in place of the injured Hellickson, gave up a two-run homer to Brian Anderson in the first. The Marlins grew their lead in the second on a bases-loaded single by pitcher Pablo Lopez. In the third, with McGowin’s pitch count already above 50, Trea Turner made two errors and Washington was lucky no damage was done.

The game soon dissolved into a series of bullpen lapses, and the Nationals nearly won the battle of futility once the Marlins pushed ahead in the eighth. But Soto and Adams had the final say, even after the Marlins put the tying run on base in the ninth, and especially after Doolittle closed the door. Soto wore a big smile when talking about the 3-1 fastball that he rocked for his eighth home run. It came in at 100 mph, but because Soto is seeing pitches so well, he thought it looked like 94. The 20-year-old has 15 hits in his past 30 at-bats and, with most of the Nationals dragging, has picked the right time to surge.

Their day started with their general manager telling them to play better baseball, simple as that, nothing more and nothing less. Their response wasn’t perfect, or even close to it, but it did bring a small measure of success.

“Sloppy,” Martinez said. “But it was a win.”