Perez supplied a solo shot in the fourth for a 2-0 Kansas City lead, and the Royals extended their advantage to 3-0 before the Mariners came back with three in the seventh to forge a tie game.
Then in the eighth, Mike Moustakas stroked a two-out double off Yoervis Medina (4-4) and Perez (3-for-4) followed by delivering the decisive run-scoring single.
Luke Hochevar (4-2) got the final two outs of the eighth to claim the decision and Greg Holland secured it with his 38th save as the Royals kept their playoff hopes alive with a third straight win.
They entered the contest trailing American League wild card-leading Tampa Bay by 4 1/2 games.
Kyle Seager belted a two-run homer for Seattle.