With the score 3-all, Matt Chapman doubled over leaping third baseman Hanser Alberto with one out and Seth Brown was intentionally walked by Scott Barlow (2-2).
Andrus, whose .213 average coming in was 140th among 143 qualified batters, followed with a sharp liner to right, and Chapman scored with a headfirst slide ahead of Jarrod Dyson's throw.
''This is a veteran guy, the moment's not too big for him,'' A's manager Bob Melvin said. ''He's done it plenty of times. Doesn't surprise me. He's done it against us many times over the years.''
Andrus delivered the game-winning hit not long after his defense helped the Royals tie the game.
Andrus made a two-out fielding error on Michael Taylor's grounder to shortstop that led to an unearned run in the eighth. Andrus then was slow on his throw to second baseman Jed Lowrie on Hanser Alberto's grounder, extending the inning.
''When you make an error (you) always want redemption,'' Andrus said. ''It's not too often you get the opportunity.''
Seth Brown homered to snap a long funk for the A's. Chapman had three hits including an RBI double.
Salvador Perez hit solo homers in the seventh against Cole Irvin and the eighth against former teammate Jake Diekman, becoming the first Kansas City player to homer twice from the seventh inning on since Mike Moustakas at Baltimore on Sept. 12, 2015. He joined Bo Jackson in 1987 as the only Royals with three multihomer games by the end of June.
''He's been amazing all season long,'' Royals manager Mike Matheny said. ''When we need big hits he seems to find it.''
Kansas City has lost six of seven.
Lou Trivino (3-2) retired four batters.
The A's are 7-2 in June, tied with the Angels and Brewers for the best in the majors.
Perez hit his 15th home run of the season leading off the seventh, then connected for a tying shot in the eighth for his ninth career multihomer game.
Brown snapped a 1 for 30 funk with his two-run homer off Brady Singer in the fourth.
PLAY AT THE PLATE
The Royals bungled a chance to add on in the eighth when Andrew Benintendi was thrown out trying to score from first on Hunter Dozier's bloop to center. Benintendi appeared to hesitate briefly after rounding third, and A's first baseman Matt Olson made a perfect relay throw to catcher Aramis Garcia who tagged Benintendi as he slid headfirst.
''It was really close,'' Matheny said. ''The cameras are so good, we could see afterward it looked like his hand was in there before the tag but hovering. He beat it. He just couldn't get that (hand) on the plate.''
Irvin allowed two runs - one earned - and six hits in six-plus inning. Singer had seven strikeouts in six innings. He allowed three runs, five hits and walked one.
Diekman has three blown saves this season. ... Whit Merrifield played in his 369th consecutive game, the longest active streak in the majors. ... Nearly two weeks after a foul ball by Juan Lagares of the Angels broke a pane of glass above the second deck at the Coliseum, the window has yet to be replaced.
Chapman made a nifty running catch to track down Benintendi's foul ball in the second inning before stumbling over the bullpen mound near the stands behind third base.
Royals: Matheny was pleased with how well LHP Danny Duffy threw Thursday but said how Duffy responds a day after is more important. Duffy has been on the injured list since May 17 with a left forearm flexor strain.
Athletics: CF Ramon Laureano (strained right hip) ran sprints, threw to bases and took batting practice before the game. Laureano also stood in the box during LHP J.B. Wendelken's bullpen session. Wendelken (strained left oblique) will throw to hitters again Monday before heading out on a rehab assignment.
A's rookie RHP James Kaprielian (2-1, 3.08 ERA) faces the Royals for the first time Saturday as he continues his comeback from Tommy John surgery in 2017. Kaprielian has allowed two or fewer earned runs in four of his five starts. RHP Jackson Kowar (0-1, 54.00) starts for Kansas City after allowing four runs and retiring two batters in his major league debut against the Angels on Monday.
More AP MLB: https://apnews.com/tag/MLB and https://twitter.com/AP-Sports
Copyright 2021 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.