MIAMI -- The Miami Marlins scored the winning run on a seventh-inning wild pitch, snapping a six-game losing streak by beating the San Francisco Giants 3-2 Sunday at Marlins Park.

The Giants saw their three-game winning streak end.

The winning rally started with a leadoff double to center by shortstop Adeiny Hechavarria, who advanced to third on a sacrifice bunt by catcher Jeff Mathis.

Giants starter Tim Lincecum (9-6) then bounced a curveball on a 3-1 pitch to pinch hitter Reed Johnson. The ball got away from catcher Hector Sanchez, allowing Hechavarria to score from third.

The win went to Brad Hand (1-2), who is just 3-12 in his major league career. Hand went seven innings, allowing six hits, one walk and two runs, and striking out four.

Bryan Morris pitched a scoreless eighth, and closer Steve Cishek did the same in the ninth, earning his 21st save of the season.

Tigers 5, Indians 1

DETROIT -- Drew Smyly held Cleveland to one run and four hits in seven innings and Torii Hunter blasted a two-run homer as Detroit salvaged the finale of a four-game series.

Smyly (6-8) struck out six while winning his second consecutive start before relievers Joba Chamberlain and Joe Nathan pitched scoreless innings. Hunter, the right fielder, scored twice while center fielder Austin Jackson added two hits and scored a run.

The Tigers prevented the Indians from sweeping them in a four-game home series for the first time since at least 1914.

Catcher Yan Gomes' 13th home run in the seventh accounted for Cleveland's offense. Starting pitcher Josh Tomlin (5-7) allowed four runs in 4 1/3 innings.

Blue Jays 9, Rangers 6

TORONTO -- Melky Cabrera hit a tiebreaking solo homer in the seventh inning and drove in three runs for Toronto.

Catcher Dioner Navarro also homered for the Blue Jays, who took the rubber match of three-game series.

Right fielder Daniel Robertson had four RBIs for the Rangers, including the two tying runs in the sixth inning.

Right-hander Todd Redmond (1-4) pitched one inning to pick up the win. Right-hander Neftali Feliz (0-1) took the loss after allowing the 12th homer of the season by Cabrera.

Yankees 3, Reds 2

NEW YORK -- Brian McCann had a bloop single with one out in the bottom of the ninth inning as New York completed a three-game sweep.

Center fielder Jacoby Ellsbury went 4-for-4 and started the ninth with a nine-pitch at-bat on pitches from Aroldis Chapman all clocked at 100 miles per hour or higher. He capped the at-bat by slapping a single to left field, then stole second and took third on a wild pitch on Chapman's slider.

Right after the wild pitch, the Reds pulled their infield in but first baseman Mark Teixeira struck out on a high fastball. McCann blooped a fly ball to short right field that fell between first baseman Todd Frazier and right fielder Jay Bruce, giving the Yankees their second walk-off win of the season.

Pirates 5, Rockies 3

PITTSBURGH -- Pittsburgh was once again able to wait out the Colorado's starting pitcher and attack the bullpen.

Outfielder Andrew McCutchen knocked in the go-ahead run with a single in the seventh and second baseman Neil Walker added insurance two batters later with his 14th home run to propel the Pirates.

Walker finished 3-for-4 with two runs scored while leading his team to its second series sweep of the year.

Pittsburgh left-hander Jeff Locke worked six innings and gave up three runs on seven hits and two walks.