MIAMI (AP) Hanley Ramirez picked a good time to end his home run drought.

Ramirez hit his first homer since June 3, ending his drought at 89 at-bats with a two-run shot in the eighth inning in a 5-2 victory over the struggling Philadelphia Phillies on Sunday.

``We've been waiting for Hanley's big day,'' Marlins manager Ozzie Guillen said.

The Marlins completed a three-game sweep of the Phillies for the first time since August 7-9, 2009, at Citizens Bank Park. The Phillies have lost five straight.

``We are trying to beat everybody, but especially in our division,'' Ramirez said. ``If you want to move up, that's what you have to do.''

All-Star slugger Giancarlo Stanton also homered, and Omar Infante and John Buck each had RBI doubles for the Marlins, who have won four straight as they look to put an 8-18 June behind them.

``June, get far away from us,'' Stanton said. ``It's good to start new and just move forward.''

Ricky Nolasco (7-6) pitched seven strong innings, striking out six and allowing five hits and two runs.

``A sweep against anybody is big, but we know how good that team is and we're trying to prevent them from getting on a roll as well,'' Nolasco said.

Nolasco improved to 8-4 with a 3.59 ERA over 14 starts against the Phillies.

``He's always been a better pitcher than people give him credit for,'' Phillies manager Charlie Manuel said. ``I've seen him pitch some real good games over the time I've been here.''

With the Marlins leading 3-2 in the top of the eighth, Steve Cishek allowed two singles before getting Shane Victorino to fly out to end the inning.

Ramirez's two-run homer came off Antonio Bastardo in the bottom of the eighth to extend the lead to 5-2.

``The biggest hit today was the home run by Hanley,'' Guillen said. ``Hanley opened up the game a little bit to give you some room for a mistake.''

Ramirez said: ``It was good for the crowd.''

Heath Bell came on in the ninth for his 17th save in 21 chances.

Philadelphia starter Joe Blanton (7-7) allowed three runs and six hits in six innings. He struck out seven.

``If we go out and throw a good game, we have trouble scraping across a couple (runs) and that's just baseball,'' Blanton said. ``Sometimes it goes that way.''

After Juan Pierre tripled and scored on a groundout by Carlos Ruiz, Miami took a 2-1 lead on consecutive RBI doubles by Infante and Buck.

Stanton's third home run in five games - his 19th overall - gave Miami a 3-1 advantage in the third. Nolasco, who had retired 11 straight at one point, was charged with two wild pitches in the sixth, which resulted in the Phillies' second run.

NOTES: The Phillies have had at least three All-Star selections in four consecutive years as LHP Cole Hamels, RHP Jonathan Papelbon and C Carlos Ruiz were selected to represent the National League on July 10. ... The Marlins placed RHP Edward Mujica (fractured right pinky toe) on the 15-day disabled list after Saturday's game and recalled LHP Wade LeBlanc. ... The Phillies selected the contract of OF Jason Pridie from Triple-A Lehigh Valley to fill the roster spot available after trading 1B Jim Thome to Baltimore. ... Marlins RHP Carlos Zambrano (4-6, 3.71 ERA) will start Monday against Brewers RHP Zack Greinke (9-2, 2.82 ERA). Phillies RHP Vance Worley (4-4, 2.92 ERA) will oppose Mets LHP Jonathon Niese (6-3, 3.55 ERA) on Tuesday.