Carlos Ruiz’s first home run of the season — a solo shot — won it in the 10th, as the Philadelphia Phillies defeated the St. Louis Cardinals, 2-1, in a pitcher’s duel at Citizens Bank Park.

Ruiz finished the game 2-for-3 and knocked in both runs for the Phillies, who have won three of four and evened the four-game set at a game apiece. Raul Ibanez had a triple, scored a run and walked twice in the victory.

Cole Hamels threw a gem, allowing just one run in eight-plus innings. Hamels gave up eight hits and two walks while fanning eight, and Jose Contreras (2-1) received the win for pitching a scoreless 10th inning.

Yadier Molina finished 3-for-4 with an RBI double in the ninth inning for the Cardinals, who had won eight of nine coming into the game. Despite the loss, St. Louis’ spectacular run of starting pitching continued, as Adam Wainwright yielded one run, four hits and two walks in eight strong innings. It was the Cards’ 13th straight quality start.

Blake Hawksworth (0-1) was dealt the loss after giving up the homer to Ruiz.

Ibanez helped Philadelphia snap the scoreless contest in the seventh, leading off the inning by working a 3-1 count and sending a fastball into the right- centerfield gap for a triple. Two batters later, Ruiz lofted a sacrifice fly to deep right for a 1-0 Phillies lead.

Hamels made the lead stick by throwing a perfect eighth, retiring Ryan Ludwick, Albert Pujols and Matt Holliday in order.

The Cardinals, though, got to Hamels in the ninth. David Freese began the frame by lining an 0-2 changeup to the gap in left-center for a double, and he scored on Molina’s opposite field double down the right field line to tie the game.

Brad Lidge came in to pitch, and Molina moved to third on Skip Schumaker’s groundout to first. After pinch-hitter Colby Rasmus was intentionally walked, Lidge struck out Brendan Ryan on three consecutive sliders. Lidge got pinch- hitter Jon Jay to fly out to deep right-center to keep the game tied.

Dennys Reyes walked Ryan Howard leading off the home ninth, but Hawksworth retired the next three hitters to send the game to extra innings.

After Contreras got through a scoreless 10th for the Phillies, Ruiz led off the home half by pulling a Hawksworth fastball for home run distance but just foul. After taking the next two pitches for balls, he launched another fastball deep into the seats in left to end the game.

Hamels cruised through the first three innings, allowing only one baserunner, and the Phillies threatened in the bottom of the third.

Ruiz led off with a double down the left field line but was erased on a close play at third on Hamels’ attempted sacrifice bunt. Shane Victorino followed with a single, and Hamels advanced to third on Placido Polanco’s fielder’s choice groundout, but Chase Utley flied out weakly to end the threat.

St. Louis put two runners on in the fourth with two outs, but Phillies shortstop Juan Castro grabbed Molina’s ground ball up the middle and retired the catcher to end the inning.

The Cardinals threatened again in the fifth, loading the bases with two outs for Pujols, who popped up to second on the first pitch.

Philadelphia had a chance in the sixth when Polanco scampered to second on an error by the third baseman Freese. Polanco moved to third on Utley’s groundout, but Howard and Jayson Werth both grounded out to end the inning without a run.

Game Notes

The Cardinals have 24 quality starts this season, the most in the majors…The Phillies improved to 2-11 in games not started by Roy Halladay where they scored six runs or fewer…Freese has an eight-game hit streak…Werth went 1- for-4 to extend his streak of reaching base to 26 games, the best in the majors…Ibanez scored his 800th career run…Philadelphia reliever Ryan Madson will miss at least eight weeks after undergoing successful surgery on his right great toe…Hamels’ earned run average decreased from 5.28 to 4.42…In the ninth inning, as Hamels was in the middle of his wind-up for the first pitch, a fan ran out onto the field, forcing the pitcher to stop before he threw the ball. It was the second instance in as many days, as a Phillies fan was Tasered on the field Monday after running onto the field. Tuesday’s incident did not result in the usage of a Taser, but the game was delayed while the person was apprehended.