ST LOUIS — Scott Kingery, with a looming loss and a rough month weighing on him, steadied himself in the batter's box with two outs in the eighth inning of Saturday afternoon's 7-6 win over the Cardinals.

It had been nearly three weeks since Kingery's last extra-base hit. He was batting just .177 in his previous 64 trips to the plate and was hitless Saturday in his first three at-bats. His throwing error an inning earlier — his second key defensive lapse in two days — led to St. Louis' taking a one-run lead. Kingery's rookie season, which began with such excitement and promise, seemed to be skidding.

He fell behind two strikes against Greg Holland, last year's saves leader. The Phillies trailed by a run and the eighth inning felt all but over with their struggling rookie down to his final strike. But Kingery refused to fold. Holland threw a low slider and Kingery turned on it, golfing it off the left-field wall for a triple. He slid into third base with a sense of relief. The game was tied, Kingery's weight was lifted, and the Phillies were six outs away from what manager Gabe Kapler said "felt like the biggest win of the year."

The Phillies are nine games over .500, have won eight of their last 10, and will try to win the four-game series on Sunday with Aaron Nola on the mound. Jorge Alfaro, scratched from the game with knee soreness, came off the bench to follow Kingery with a pinch-hit, go-ahead single. And don't forget Nick Williams, who started the rally with a two-out walk.

Holland, who signed with the Cardinals in March for $14 million, was booed when he walked off the mound after being removed. The Cardinals were suddenly trailing after being just one strike away from carrying a lead into the ninth inning.

"Personally, for that at-bat and any at-bat I'm trying to grind it out and find any way I can to help my team in that AB," Kingery said. "It's obviously been a struggle with some stuff I've had to grind through. I feel like I'm taking steps forward every day, whether it's the way I feel at the plate, the way my swing feels, I think it's all moving forward and I'm just trying to climb out of what's been going on for the last couple of weeks."

Kingery attributed  his struggles to problems he was having with his swing. He could not find a rhythm, which then ruined his approach. Kingery said he found himself chasing bad pitches and watching fastballs down the middle. The first seven weeks of the season have been his introduction to major-league pitching. He has been searching for an adjustment and seemed to find it on Saturday.

"I'm really happy for Kingery, he showed a tremendous amount of mental toughness," Kapler said. "One of the things that we've stressed all along for Scotty is how he's not fazed by big moments, he's not fazed by pressure, and he's clearly not fazed by struggling. That's why we have so much confidence in him. … We did see Scotty even at the beginning of the season have those kind of at-bats where he would get down in the count, battle back and get a big hit for us. We never, ever waver in our confidence with our players and in particular with Scott, we know it's just a matter of time until he clicks and before he takes off the way we know he can."

Kapler turned to Seranthony Dominguez to record the final six outs and the rookie earned his first professional save after spending the previous six seasons in the minor leagues as a starting pitcher. Dominguez needed just 12 pitches to retire the three batters he faced in the eighth, so the Phillies pushed him back out for the ninth. He retired three more batters and has yet to allow a hit in his first six major-league appearances.

Odubel Herrera hit a two-run homer in the third inning to reach base for the 45th-straight game, the fourth-longest stretch in franchise history. Two more runs scored on his fielder's choice in the fifth when the Cardinals failed to complete an inning-ending double play as Jedd Gyorko's throw skipped past first base.

Zach Eflin allowed four runs, two of which were earned, in 4 2/3 innings. Eflin had a strong fastball, which touched 97 mph, and flashed a moving slider before his outing was shortened by a thunderstorm that delayed the game in the fifth inning. Eflin struck out four, walked three, and allowed three hits.

The Phillies will have to make a decision soon on their starting rotation because Jerad Eickhoff is nearing  a return from the disabled list. Eickhoff will start Sunday for triple-A Lehigh Valley and the Phillies plan to slide him into the rotation at the end of his rehab, which could make Eflin the odd man out.

Tommy Hunter started the bottom of the seventh by forcing Tommy Pham to hit a grounder to third base. Kingery charged, grabbed the ball, and fired to first in time to nab Pham, but his throw sailed wide of first baseman Carlos Santana. Pham moved to second and scored the go-ahead run when Matt Carpenter, the next batter, doubled. It was almost certain that Kingery's afternoon would be remembered for a throwing error. But then the game found him just a few minutes later and gave him a chance at redemption when he came to the plate with two outs in the eighth inning. He  did not let the moment pass.

"I like the way things are going for me. I'm feeling good," Kingery said. "I feel like I'm getting better every day. That big hit definitely helps. Obviously, I'm just happy we could get a win."