Cano's shot in the fourth helped the Yankees start the unusual portion of their interleague schedule — they'll face an NL opponent every month this season.
Ivan Nova (1-1) labored through five innings in his first game since April 5. Rivera pitched a perfect ninth for his third save.
"It's kind of funny seeing 42 face three 42s," Girardi said.
Brandon McCarthy (0-2) escaped bases-loaded jams in the first two innings before Cano hit his fourth homer for a 3-2 lead. McCarthy threw 102 pitches in the short outing.
"Just completely out of sync. I was not able to do a whole lot," he said. "I don't know what it was. I couldn't get right."
Eduardo Nunez added a sacrifice fly in the seventh.
Arizona took a 2-0 lead in the third on a sacrifice fly by Miguel Montero and an RBI single by Cody Ross.
NOTES: Cano's father, Jose Cano, pitched six games for Houston in 1989. ... Brittney Griner, picked No. 1 overall by the Phoenix Mercury in this week's WNBA draft, visited with manager Kirk Gibson and the Diamondbacks around the cage during batting practice. ... Injured Yankees SS Derek Jeter had a second straight day of on-field work at the spring training complex in Tampa, Fla., after two off days. Girardi said Jeter isn't likely to rejoin the team by May 1, once a projected return date. ... Yankees RHP Chien-Ming Wang will make his first start of the season for Triple-A Scranton/Wilkes-Barre on Friday night against Syracuse. ... There was a pregame moment of silence for former New York Giants football star Pat Summerall.