Alex Rodriguez played at home for the first time this season while going hitless in four at-bats and Mariano Rivera blew his second straight save opportunity. Nevertheless, the Yankees eventually prevailed to bring a halt to the Tigers' longest win streak in 79 years.
Nix drew a leadoff walk against Al Albuquerque (2-3) in the 10th, went to second on a single by Curtis Granderson and reached third on a wild pitch.
Nix was still on third with two out when Gardner singled to left on an 0-1 pitch.
New York took a 3-1 lead into the ninth before Rivera gave up a two-run, two-out homer to Miguel Cabrera.
Rodriguez struck out three times in his first appearance at Yankee Stadium since last year's playoffs. He is playing while appealing a 211-game suspension by Major League Baseball.
The win went to Shawn Kelley (4-1), who recorded the final out in the top of the 10th.
Video of Victoria’s Secret models trying to 'twerk' hits Instagram
Megyn Kelly: Santa Claus and Jesus are both white men