Shelby Miller (photo/MLB)

Shelby Miller (photo/MLB)

Xander Bogaerts knocked in both of Boston’s runs, including a go-ahead sacrifice fly in the ninth inning, as the Red Sox beat the St. Louis Cardinals, 2-1, in the middle test of a three-game series.

The Cardinals sent Trevor Rosenthal (1-6) to the mound in the ninth. Yoenis Cespedes singled, Mike Napoli doubled and pinch-hitter David Ortiz was intentionally walked to load the bases with no outs. Bogaerts followed with a sacrifice fly to center.

Boston sent out Koji Uehara to close things out in the bottom half. He put men on first and second with two outs before getting Jon Jay to ground into a fielder’s choice to end it. Uehara picked up his 23rd save of the season.

Former St. Louis pitcher Joe Kelly gave up one run on three hits with four walks over seven innings in his Boston debut. Kelly was traded to the Red Sox last week in the deal that sent John Lackey to the Gateway City.

“Definitely good to get that win in there,” Kelly said. “I had a good time, I enjoyed it, I had fun. Especially pitching against the Cardinals.”

Junichi Tazawa (2-3) tossed a perfect eighth to get the win for Boston, which snapped a three-game skid.

Shelby Miller allowed one run on four hits over seven innings for the Cardinals, who had a three-game winning streak snapped.

“I thought (Miller) was very, very good today,” praised Cardinals manager Mike Matheny.

The Cardinals scored their only run in the first. Matt Carpenter led off with a double and crossed the plate on Matt Adams’ single to right.

Boston tied the game in the fourth. Daniel Nava hit a two-out single and raced home on Bogaerts’ double to left.