Kansas City moved within three games of idle Cleveland for the second American League wild card with six games remaining -- all on the road. Texas is a game behind the Indians.
Gordon saved the Royals in the 10th inning, when his one-hop throw to Perez from left field cut down Kyle Seager for an inning-ending double play.
"Alex Gordon's golden arm, and great tag play by Salvy," Royals manager Ned Yost said.
Holland walked the first two batters in the 12th, then retired three straight to end it.
"I'd like to tell you we did that on purpose," he said, "but we didn't. This team has been resilient all year, and people are starting to see that now. It's one great defensive play after another. It's clutch hits. When we're not hitting early, the pitching keeps us in games."
Perez, who had three hits, sent the next pitch into the left-field corner. Gordon scored, and Giavotella was thrown out at the plate.
Wade Davis (8-11) pitched two hitless innings for the win. Holland earned his 45th save in 48 chances to tie Dan Quisenberry (1983) and Jeff Montgomery (1993) for the club record.
Holland said that achievement "maybe will sink in later sitting at home during the offseason. But right now I'm just thinking of helping us win."
"They did a good job of picking me up tonight," Hochevar said. "You want to be a little smoother. We could have done without the back-to-back home runs, but at this point of year, winning is the bottom line."
Seager opened the 10th with a double off Francisley Bueno and went to third when right fielder Justin Maxwell bobbled the ball for an error. Kendrys Morales was intentionally walked before Davis took over and struck out Gutierrez.
Saunders was intentionally walked, loading the bases. Pinch hitter Endy Chavez lifted a fly ball to left and Seager tagged up, but Gordon's throw to the plate was barely in time.
"Gordon took a couple steps back and I went for it and it didn't go our way, I guess," Seager said. "I thought we had done enough to win, but they battled back."
Perez said his first priority was to catch the ball.
"He put down a pretty good slide," Perez said. "I just put my glove on home plate, and he touched my glove. The umpire was in a good position."
With their 21st extra-inning game, the Mariners matched the 1982 team record. They have lost 15, three more than the previous mark of 12 set in 1982. Seattle has dropped eight straight in extra innings, equaling last year's club.
The Royals opened the scoring with two runs in the fourth off Brandon Maurer. Billy Butler had an RBI single, and Hosmer scored when right fielder Abraham Almonte's throw to third sailed into the stands for an error.
Yordano Ventura, making his second big league start for the Royals, allowed one run and two hits in 5 2/3 innings. The hard-throwing right-hander struck out six, but three walks hastened his departure.
Kansas City rallied for three in the eighth to take a 5-3 lead.
Bonifacio tied it with an RBI single, and Gordon scored when Hosmer grounded into a fielder's choice. Seattle tried to turn an inning-ending double play, but a throwing error by second baseman Nick Franklin allowed Hosmer to reach second. Perez added an RBI single.
"Every game from now to the last game of the season is important to us," Perez said. "We can't think about the other teams, what happened. We just need a win. We can't control other teams. The only thing we can control is our game."
Royals RHP James Shields, hit on the right elbow by a line drive in the third inning Sunday, showed no ill effects Monday, according to Yost. Shields remained in the game and threw eight shutout innings against Texas. He is expected to make his start Friday against the White Sox. ... Mariners LHP Joe Saunders, who lost 6-5 on Saturday to the Angels, is not expected to start again this season. "As of right now, that's what we're looking at," manager Eric Wedge said. Saunders is 11-16 with a 5.26 ERA in 32 starts. ... Almonte has reached base safely in all 17 games to begin his major league career and has a hit in 15 of them. It's the second-longest such streak in club history.