Hamels (8-2) gave up a season-high five runs on seven hits in 6 2-3 innings as the Philadelphia Phillies lost to the Miami Marlins 5-4 on Saturday.
Hamels is 0-2 in two starts against Miami and 8-0 in nine starts against everyone else.
"We faced one of the best pitchers in the game right now and we handled him pretty well," Marlins manager Ozzie Guillen said.
Hanley Ramirez homered twice off Hamels, denying the left-hander his ninth victory.
"They are a good team, but I think that both games that I pitched against them, it's a matter of making too many mistakes," Hamels said.
Ramirez homered in his second straight at-bat in the sixth, a two-run shot to left, to give Miami a 4-3 lead. After Omar Infante led off the inning with an infield single, Ramirez drove Hamels' 2-2 changeup into the seats in left for his 12th career multihomer game.
"Hanley is a good hitter, one of the best hitters in the game," Guillen said. "He's got some credentials. Hanley is good against anybody; there's no doubt in anybody's mind that kid can hit."
Ramirez said he didn't do anything differently against Hamels.
"You don't change your approach," he said. "You just go out there looking for a good pitch to hit and it's what we've been doing."
Jose Reyes increased the lead to two runs with a two-out RBI double to left that put Miami up 5-3 and spelled the end for Hamels.
It was the left-hander's first loss since his first start, a 6-2 defeat to Miami on April 9. Hamels was attempting to become the first nine-game winner in the majors.
"I wasn't able to execute first pitch and when you are in a situation where you are falling behind over and over again, you are putting yourself in a bad position," Hamels said.
Said Phillies manager Charlie Manuel: "I felt like he got a little bit out of whack the last two innings he pitched."
Ricky Nolasco (6-3) allowed four runs on eight hits in seven-plus innings, helping the Marlins to their sixth win in eight games.
"I told the coaching staff Nolasco better bring his 'A' game today because we know Cole is going to throw well," Guillen said. "After the first couple of innings, he pitched well. He kept us in the game and gave us a chance to win."
Nolasco improved to 6-1 in seven career starts at Philadelphia.
"Even just watching games here, it's so exciting," Nolasco said. "The fans sell it out. If you don't enjoy pitching here whether you're a visitor or if this is your home team, then something is wrong with you."
Hunter Pence homered for the second straight game for the Phillies, who lost for just the third time in 10 games.
The Phillies got a run back in the eighth. Jimmy Rollins led off with a triple to right and Juan Pierre walked to put runners on first and third. Guillen lifted Nolasco for Steve Cishek. Pence hit a sacrifice fly off Cishek, scoring Rollins, but the right-hander sandwiched strikeouts of Carlos Ruiz and Ty Wigginton around a walk to Shane Victorino to preserve Miami's lead.
Heath Bell pitched a scoreless ninth for his 11th save in 15 chances. Bell allowed the tying run to reach second with one out, but got pinch-hitter Brian Schneider and Rollins to pop out.
"We were sitting right there today," Manuel said. "We could have definitely won the game. It was ours for the taking. We didn't get the big hit at the right time."
Juan Pierre scored in the first on Ruiz's groundout to give the Phillies a 1-0 lead. Ruiz entered leading the majors batting .381.
Rollins' RBI infield single in the second and Pence's leadoff homer to right in the third put Philadelphia ahead 3-0.
The Marlins got a pair of runs back in the fourth on Ramirez's leadoff homer to left-center and Justin Ruggiano's RBI double to right. Umpires reviewed Ramirez's homer to see if a fan interfered with the ball, but confirmed it a homer after a short delay.
"Hanley is a great hitter," Nolasco said. "He started off slow but he's been coming around. He's seen Cole Hamels a lot and maybe that had something to do with it, but he put together two big at-bats that were pretty much the whole game for us."
Ramirez is batting .444 (20 for 45) in his last 12 games.
"We've been playing pretty good baseball so we're going to try to continue to do that," Ramirez said. "Everybody is having fun and everybody is together. That's what you can call a team."
NOTES: Jose Contreras' season is likely over after an MRI Saturday revealed the Phillies reliever has a torn UCL and flexor pronator tendon in his right elbow. The 40-year-old Contreras had right elbow surgery last year. He reinjured the elbow in the seventh inning Friday night while facing Infante. ... The crowd of 45,509 was the Phillies' 230th straight regular-season sellout and 246th counting postseason play. ... Philadelphia fell to 0-20 when trailing after seven innings. ... Marlins RHP Carlos Zambrano (3-3, 3.00) is scheduled to face Phillies RHP Joe Blanton (4-5, 5.05) at 1:35 Sunday in the finale of the three-game set.