Giancarlo Stanton hits two home runs as the Marlins beat the Cubs in their series finale.

Stanton homered twice and drove in four runs Sunday, and Miami beat the
Chicago Cubs 6-4 to avert a four-game sweep.

The Marlins improved to 6-19, still worst in the majors, and 3-10 at home. They benefited from a rare offensive outburst, scoring more than three runs for only the fifth time this season and twice coming from behind.

Stanton led the way, showing further signs he has shaken a prolonged slump to start the season.

"It was just a matter of time," manager Mike Redmond said. "This guy is a special player. He's a game-changer."

Nick Green also hit a homer, and confessed he didn't remember his last one because it came so long ago -- in 2009.

Green said the return of Stanton's power stroke gave the rest of the Marlins a boost.

"It's huge for this team," Green said. "Everybody expects him to hit a home run or get a guy in every single time, which isn't possible. But having him get his confidence back is the biggest thing to lift our team up."

Ricky Nolasco (2-2) gave up three runs in seven innings and retired the final 15 batters he faced.

Stanton, who led the NL in slugging last year, waited 65 at-bats to hit his first homer Saturday. He hit another in the first inning off Carlos Villanueva to put Miami ahead 2-1.

The All-Star right fielder singled home a run and later scored in the sixth. He homered again leading off in the eighth against Kameron Loe and finished 3 for 3 to raise his average to .243.

Stanton had been 0 for 4 with four strikeouts previously against Loe. The multihomer game was his seventh.

"When you see guys hit balls that hard, that's pretty fun to watch," Redmond said. "It takes that pressure off everybody. Everybody is, `OK, we can relax now. I don't have to carry the weight of the offense.' When he's going good, we have a chance to do some damage."

Stanton didn't talk with reporters after the game.

"Even though he was struggling, guys like that are due to break out," said Villanueva (1-1). "Obviously you don't want it to happen against your team. I made a couple of mistakes on him, and he took advantage."

Villanueva allowed four runs in six innings, raising his ERA to 2.29.

Nolasco fell behind 3-2 when he permitted the first four batters to reach in the third inning, then didn't allow another baserunner. He improved to 5-2 against the team that drafted him in 2001.

Chicago's Dioner Navarro homered in the ninth off Steve Cishek, who nonetheless earned his third save in four chances.

The Cubs' poor hitting with runners in scoring position persisted. They went 1 for 8 in those situations.

"We're out there battling right to the last inning, and you saw that again today," manager Dale Sveum said. "It's just one of those things you have to work through."

Chicago, last in the NL Central, heads home after going 4-6 on a three-city trip.

Stanton's first-inning homer was the only hit allowed by Villanueva until the sixth, when Juan Pierre singled with one out and stole second. Stanton hit an RBI single and took second on the throw home, then scored on a two-out single by Donovan Solano that put Miami ahead to stay, 4-3.

Green drove in his first run this season with a homer off Loe in the seventh.

Anthony Rizzo's double off the wall scored David DeJesus from first base in the Cubs' first. Villanueva and DeJesus singled to start the third, and Starlin Castro followed with a two-run double that gave Chicago a 3-2 lead.

NOTES: Marlins 1B Joe Mahoney sat out and is day to day with a tight right hamstring. ... SS Castro made a diving catch of Solano's liner to end the first inning. ... Beginning Monday against San Diego, the Cubs play 16 of their next 19 games at home. ... The Marlins improved to 82-81 against the Cubs. ... Two of the game's top young pitchers will square off Monday when the Marlins' Jose Fernandez goes against the Mets' Matt Harvey.