NEW YORK, N.Y. - Christian Yelich saved Joe Girardi from a difficult decision.

Yelich broke up Michael Pineda's no-hit bid with a home run on the first pitch of the seventh inning, and the New York Yankees held on to beat the Miami Marlins 2-1 Wednesday night.

Pineda had thrown 94 pitches through six innings, and Girardi knew he likely would remove the right-hander from the game before the end, even if the Marlins remained hitless.

"I don't think it's a situation where you can let a guy throw 130, 140 pitches," the Yankees' manager said. "It would be extremely difficult for me and I would feel bad, but sometimes as a manager you have to protect players from themselves."

Alex Rodriguez singled twice off Miami rookie Jose Urena (1-3) to raise his career hits total to 2,997. Marlins first baseman Justin Bour saved two runs with a diving catch, and an overturned call at home plate prevented Miami from scoring the tying run in the eighth inning.

"It was as fun a game as we played all year," Rodriguez said. "There was all types of things going on. If you like baseball, tonight was a good one."

Rodriguez lined an RBI single to centre in the first inning, singled softly to centre in the fifth, walked twice to reach in all four plate appearances and also was thrown out at home plate. With New York starting an eight-game homestand, he has a good chance to get No. 3,000 at home.

"It's always on your mind a little bit," he said.

Carlos Beltran hit an RBI single for a 2-0 lead in the fifth, and the overturned call helped New York win for only the second time in seven games.

Plate umpire Dale Scott ruled Adeiny Hechavarria slid home ahead of first baseman Garrett Jones' throw on Dee Gordon's grounder, but a video review concluded catcher Brian McCann grabbed the high throw and tagged Hechavarria's left knee before his foot touched home.

"You catch it and dive to where you think the slide's going to be," McCann said.

Hechavarria thought the run should have counted.

"I really thought my foot got in there," he said through a translator. "After the play happened, I came into the clubhouse and looked at the replay and still believe I was safe."

Pineda (8-3) was back on regular rest and regained his electric slider. After the Yankees skipped his turn in an effort to limit his innings, the 26-year-old right-hander allowed six runs in an 11-3 loss at Baltimore on 10 days' rest.

He retired his first 11 batters against the Marlins, then walked Yelich with two outs in the fourth and Bour with one out in the fifth.

Pineda needed 43 pitches to retire his first nine batters, but threw 20 pitches in the fourth inning and 19 in the fifth, raising his total to 82. It was only then he realized he had not allowed a hit.

Girardi had been hoping for quick innings.

"What if he got seven first-pitch outs?" he said. "I doubt that that's going to happen, but I mean it's possible, right?"

Girardi thought back to May 10, when he pulled Pineda after eight innings and a career-high 111 pitches against Baltimore.

"I was in a bad spot there. People questioned me pulling him out with 16 strikeouts, to go for the (club) record," he said.

Yelich reached down for a 91 mph fastball and sent it into the Yankees' bullpen for Miami's first ball out of the infield. Pineda retired the next two batters, then was replaced by Chasen Shreve following his 100th pitch. Pineda struck out nine.

Dellin Betances relieved Justin Wilson with runners at the corners and one out in the eighth and finished the three-hitter for his fourth save. With two on and two outs in the ninth, Jeff Mathis struck out when he swung over an 86 mph breaking ball.

"Thank goodness for review," Girardi said.

WEB GEM

Bour made a diving backhand play at first to rob Jones of a two-run hit in the seventh, the ball sticking out of his glove's webbing.

SIGNING

New York has agreed to a $1.8 million signing bonus with shortstop Kyle Holder, the 30th overall pick in the amateur draft, which is below the $1,914,900 slot value.

TRAINER'S ROOM

Yankees: First baseman Mark Teixeira sat out with a sore neck that has been bothering him for a week. ... Right-hander Masahiro Tanaka, who has made three starts since returning from the disabled list, will start Sunday against Detroit on five days' rest. Adam Warren will start Friday's series opener, and the Yankees have not said who will start Saturday. Nathan Eovaldi, knocked out in the first inning Tuesday, and Triple-A Scranton/Wilkes-Barre's Bryan Mitchell appear to be the candidates. ... Ivan Nova, returning from Tommy John surgery, is scheduled to start for Scranton on Friday in what could be his final rehab outing.

UP NEXT

Miami RHP Mat Latos (2-4) starts Thursday's series finale against CC Sabathia (3-7).