Ichiro Suzuki drew a walk from Yoervis Medina (1-2) to open the ninth. Jayson Nix sacrificed him to second. Then with two outs, Stewart bounced a grounder to through the left side as Suzuki, the former Mariners star, scored easily to help New York take three of four from Seattle.
Mariano Rivera allowed two hits and a walk in the bottom of the ninth in finishing for his 23rd save in 24 opportunities this season and majors-best 631st of his career. Rivera has converted 37 of 39 save chances in his career against Seattle.
David Robertson (4-1), who worked out of an eighth-inning jam, earned the victory.
Brett Gardner had four hits for the Yankees, finishing 8 for 14 for the three-game series. It was his second four-hit game this season.
Phelps worked six innings, allowed just three hits, one run and struck out six. He walked three. Hernandez went one inning deeper, giving up five hits and two walks in seven innings. He allowed a run and struck out seven.
The Yankees had their prime chance to get to Hernandez early, loading the bases in the first inning. Gardner singled to right and, with two outs, Travis Hafner and Vernon Wells walked. It was first time Hernandez issued back-to-back walks this season.
Suzuki then struck out on a pitch in the dirt.
Hernandez threw 26 pitches in the inning, the second most pitches he has thrown in an inning this season. That ultimately limited his staying power at the back end, leaving after throwing 108 pitches through seven.
The Yanks pushed a run across in the second. Jayson Nix opened with a single through the right side and stolen second. With one out, Stewart reached on a bunt, moving Nix to third. Gardner sent him home with a single to center.
But the Mariners came right back in the bottom half. Kelly Shoppach hit a one-out double to left and Michael Saunders moved him to third with a groundout. He scored on Brendan Ryan's infield single to deep short.
That would be that last hit by the Mariners over the next 5 1-3 innings. Phelps retired 10 straight batters at one point, five by strikeouts.
Hernandez also settled in as he allowed just one hit over the last 18 batters he faced, striking out the final two in the seventh.
It was Hernandez's 22nd career no-decision when pitching at least seven innings and allowing one or no runs. He remains 8-5 in 16 career starts against the Yankees with a 2.89 ERA.
The Mariners had their best chance to go ahead in the eighth. Alex Liddi opened with a double to right off Robertson. Ryan sacrifice him to third. But Robertson struck out both Jason Bay and Nick Franklin.
Kyle Seager's single in the ninth extended his hitting streak to 13 games.
NOTES: The Yankees won the season series over the Mariners, 4-3. The Yankees are 9-0-2 in season series against Seattle since 2003. ... The Mariners traded minor league infielder Vinnie Catricala, 24, to Oakland for a player to be named or cash considerations. Catricala was designated for assignment June 2 when RHP Jeremy Bonderman was selected from Triple-A Tacoma. . Kevin Youkilis was held out of the Yankee lineup because of lower back stiffness. He hurt the back sliding into first Saturday on a defensive play. With Monday's off day, Manager Joe Girardi hopes two full days out of the lineup can help him recover. . Gardner's first-inning stolen base gave him 147 for his Yankee career. That passed Bert Daniels and tied Bernie Williams and Tony Lazzeri for 13th place on the franchise's list. . Three members of the U.S. National soccer team were part of the first-pitch ceremony, goalkeeper Tim Howard, forwards Clint Dempsey and Eddie Johnson.