Jason Castro didn’t even bother moving far behind the plate to offer words of encouragement to Erik Bedard after Yadier Molina ripped a two-run home run in the first inning Wednesday night.

If it had been a younger pitcher prone to being rattled, Castro might have visited the mound after the worst possible beginning for the Astros through the first two pitches against the Cardinals.

As Castro expected, the veteran lefthander settled down for a gritty performance against the former NL Central rivals at Minute Maid Park. The Astros mounted a four-run rally in the fourth for 4-3 victory to earn a split in the two-game set.

“He knows exactly what he needs to do,” Castro said. “He’s a professional out there. He’s been doing this a long time, and it shows. He didn’t get rattled by it. He got back up there and did his job.”

The Cardinals mounted a final threat in the top of the ninth, but closer Jose Veras struck out pinch hitter Daniel Descalo and induced Matt Carpenter’s fly out to right field to strand two runners and earn his 16th save before a crowd of 17,428.

“There wasn’t much adjustment,” Bedard (3-3) said after giving up seven hits and three runs with six strikeouts and one walk in six innings. “It was only two pitches. They got off to a lead early, and I just figured I’d do my best to not give up anymore.”

Bullpen seals the deal

Righthander Josh Fields added two-thirds of an inning, and Wesley Wright pitched a third of an inning to hold the lead in the seventh. Jose Cisnero handled the eighth, retiring the hot Molina on a grounder to first before walking Carlos Beltran and then striking out Allen Craig and Matt Holliday.

Cardinals righthander Lance Lynn (10-2) gave up four runs on five hits and four walks with four strikeouts over 7 2⁄3 innings for only his second loss of the season.

One night after losing 13-5, the Astros seemed in trouble right away.

Carpenter hit Bedard’s first pitch for a bunt single down the left side. Molina then ripped Bedard’s next pitch for a two-run home run to left.

“It’s defeating watching that happen … (but) you’ve just got to stay positive and just play it out,” Astros left fielder Chris Carter said.

Craig led off the fourth with a home run high above the railroad tracks behind left field to give the Cardinals a 3-0 lead.

Jose Altuve then singled to center, and Castro singled to left to start the fourth. Carter drew a four-pitch walk to load the bases.

Carlos Pena plated a run with another four-pitch walk. J.D. Martinez drove in another run with a fielder’s choice grounder to third. Brett Wallace then added an RBI single up the middle to tie the score at 3.