WASHINGTON (AP) -- Denard Span's approach with the bases loaded in the bottom of the ninth inning proves math pays off.
Facing a five-man infield, Span hit a sacrifice fly in the ninth and the Washington Nationals, with Bryce Harper back in the lineup and stealing his first base of the season, rallied past the St. Louis Cardinals 3-2 Sunday.
The Nationals loaded the bases against Seth Maness (0-1) when Danny Espinosa singled through third baseman Matt Carpenter's legs with one out for his third hit, Jose Lobaton singled through the right side of the infield and pinch hitter Nate McLouth walked.
In his second game since being activated from the seven-day disabled list following a concussion, Span lofted a fly to left field. Espinosa easily beat the throw from Jon Jay, who shifted over from right field as St. Louis brought in an extra infielder.
''I counted: one, two, three, four, five,'' Span said. ''Right there I told myself a groundball probably not going to do it. Try to get the ball in the air somehow.''
After Espinosa crossed home, the Nationals mobbed Span, who suddenly had something else on his mind.
''I was screaming so loud, so into the moment, but at the same time I'm thinking don't hit me upside the head too hard because I just came off the DL,'' said the smiling center fielder, who grounded out with the bases full in the sixth before delivering the game-winner.
The Nationals split the four-game series. They had lost eight of the previous nine meetings with the Cardinals going into the series wrap-up.
''That's a play I'm expecting to make and a play that I expect myself to make and I didn't make it,'' Carpenter said of his ninth-inning whiff. ''It ended up costing us.''
Harper started in left field and went 1 for 4. The two-time All-Star was pulled from the game a day earlier for what manager Matt Williams called a ''lack of hustle'' after he failed to run out a comebacker to the mound.
The two spoke before Sunday's game.
''I sat with him for a couple of minutes in his locker and told him I'm confident in him and I'm proud of him and he was going to have impact today, which he did,'' Williams said.
Harper had a somewhat different take on the conversation with Williams, as far as length goes.
''He just said, 'Go get 'em.' That's the three words he said,'' Harper said. ''It's good to get back out there and play and be part of a win.''
Harper was left stranded at second base as the possible go-ahead run as Anthony Rendon struck out against Pat Neshek in the eighth.
Rafael Soriano (1-0) pitched one inning for the win.
The Cardinals took an early edge against Stephen Strasburg and led 2-0 going into the seventh.
Washington tied the game with four straight singles off reliever Carlos Martinez, including RBI hits from Ian Desmond and Espinosa.
Strasburg struck out nine in six innings.
Shelby Miller left with the lead after pitching 5 1-3 innings for the Cardinals. He also hit a two-out, RBI double off Strasburg in the fourth.
St. Louis starting pitchers recorded an RBI in three of the four games versus Washington. Miller allowed four hits, striking out seven and walking five.
Matt Adams doubled twice and scored for the Cardinals.
''I was pretty happy we were able to put a couple together and obviously a big hit by Shelby,'' manager Mike Matheny said. ''That gives you a little bit of room and then we get the ball into the hands of guys we like to give the ball to. Good offenses are going to put together tough at-bats on tough pitching, and today they got us.''
True, though it took some doing. Washington left 17 runners on base and went 2 of 12 with runners in scoring position.
''Talk about those opportunities and giving ourselves that multiple times in the game, you like your chances, certainly,'' Williams said. ''Especially against a good team like that we want to create those. I don't know how many guys we had on base today but it felt like a lot.''
NOTES: Cardinals OF Matt Holiday didn't play. It was a day of rest, Matheny said. ...St. Louis will recall LHP Tyler Lyons from Triple-A Memphis to start at the New York Mets and send RHP Jorge Rondon to Memphis before Monday night's series opener. Last season Lyons finished 2-4 with a 4.75 ERA in 12 appearances, including eight starts for the Cardinals. He replaces RHP Joe Kelly (strained left hamstring), who was put on the disabled list Thursday. ... The Nationals open a three-game home series with the Los Angeles Angels on Monday night with Washington RHP Tanner Roark (1-1, 5.29) facing RHP Garrett Richards (2-0, 2.84).