Henderson Alvarez pitched into the eighth inning to outduel Cole Hamels and the Miami Marlins beat the Philadelphia Phillies 2-0 Tuesday night.

(Getty Images)

Alvarez (12-6) gave up five hits and struck out two over 7 2-3 innings to lower his ERA to 2.70. Jeff Baker and Casey McGehee had RBIs for the Marlins in the 2-hour, 20-minute contest.

Hamels (9-8) allowed seven hits and two runs in seven innings. He struck out four and walked one.

Alvarez issued a two-out walk to Carlos Ruiz in the top of the eighth inning, ending his night after 97 pitches as he was replaced by left-hander Mike Dunn. After Chase Utley singled, Dunn struck out Ryan Howard with runners on first and second to end the inning.

Steve Cishek pitched the ninth for his 38th save in 42 chances.

Hamels got into trouble in the fourth inning when he allowed consecutive singles to Jeff Baker, Jarrod Saltalamacchia, and Lucas - who drove in Baker with his base hit to center.

The Marlins extended the lead to 2-0 in the fifth after Christian Yelich doubled and eventually scored on a sacrifice fly by McGehee.

Only two Phillies runners advanced to scoring position against Alvarez, who calmly retired the next batter each time to end the second and fifth innings.

Alvarez was just four outs away from his fourth shutout of the season.

Hamels will look to reach the 200-inning plateau for the fifth consecutive season when he makes his final start of the year on Sunday against Atlanta.

The Marlins have not yet decided on their rotation for the rest of the final week.

(Copyright 2014 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.)