KANSAS CITY, Mo. -- Zack Greinke threw 109 pitches in holding the Kansas Royals scoreless for 8 1/3 innings.
Frieri (3-1) replaced Greinke with one out in the ninth after Alex Gordon singled. Butler homered to center on Frieri's first pitch to tie it. Three pitches later, Perez hit a flyball off the left-field pole for his first career walkoff homer.
"This ballpark can play funny sometimes," Butler said. "I knew that one was gone. We knew we were looking for a fastball. I told Sal on deck, `You'd better not be late' and neither of us was late."
All Greinke could do was watch the dramatic turn of events.
"It was pretty amazing," Greinke said. "I don't think I've ever seen back-to-back homers to walk off like that. I don't know if it's ever happened. You don't see that I think ever.
"It's part of baseball," Greinke added. "Ernie's got a great fastball. Butler is a good fastball hitter. Yesterday he got it by them. He threw his best pitch to both of those guys and it just didn't work out."
Greinke gave up just five singles, walked two and struck out three in 8 1/3 innings. He has allowed seven runs and 24 hits in 37 innings for a 1.70 ERA in his past five starts.
Greinke, who has thrown up to 118 pitches in a game this year and at least 103 pitches in all 10 of his Angels starts, said he could have finished.
"Yeah, but I mean I'm not going to second guess," Greinke said. "I think he's (Mike Scioscia) probably the best manager in baseball at least from the outside looking in and so far being here. He's smarter than me."
Greinke has not pitched a complete game since 2009 when he won the American League Cy Young Award while with the Royals.
"We were getting to that point where I wanted to give them a different look," Angels manager Mike Scioscia said on pulling Greinke. "Obviously it didn't work. Zack was getting near 110 pitches. Ernie just hit a couple of bats with fastballs. He left them up, middle in and those guys didn't miss them."
The Angels entered the day 2½ games back of Baltimore and New York for the second wild-card spot in the AL
"Anytime you lose a game late it's a heavier page to turn, but we have to come out tomorrow," Scioscia said. "We're at the point in the season where everything changes, inning to inning, pitch to pitch."
Guthrie, who was 4-0 with a 1.70 ERA in his previous seven starts, faced the minimum number of batters the first four innings. He gave up a fourth inning leadoff single to Mike Trout, but picked him off first. Guthrie left after eight innings, allowing two runs on five hits.
"I thought early my fastball was good," Guthrie said. "I left a fastball up to Morales, but I got some groundballs and we played good defense. The majority of your games are against tough lineups. When you go up against that you anticipate a dog fight."
Kelvin Herrera (3-3) replaced Guthrie and picked up the win with a scoreless ninth.
Greinke, who was acquired from Milwaukee in a trade on July 27 trade, pitched out of a first inning jam.
Alcides Escobar, who had two of the hits off Greinke, singled with one out to extend his hitting streak to a career-high 11 games. Escobar advanced to third on Gordon's groundball single to right.
Escobar was out at the plate when he attempted to score on Butler's grounder to third baseman Alberto Callaspo. Perez's grounder to Callaspo ended the inning and threat.
The Angels added a run in the eighth, when Vernon Wells led off with a single and advanced to third on two groundball outs. After Trout walked, Torii Hunter laced a run-scoring single to right that Francoeur apparently lost in the lights as it glanced off the heel of his glove. Hunter leads the American League with a .349 average since the All-Star break and has 16 RBIs in his past 17 games.
RHP Ervin Santana might be pushed back a few days in the Angels rotation after being struck in the arm by Josh Donaldson's liner in Wednesday's start against Oakland. "Ervin just got smoked on the forearm," Scioscia said. "We might take a couple of days with him. Ervin's going to get the ball; he's going to pitch. It's set him back a little bit as to when he's going to throw his `pen. He'll throw a couple of light things. He'll probably throw this weekend and then we'll see where he is." . Royals 2B Johnny Giavotella committed two errors. The Royals had committed just five errors in their previous 18 games. .This series closes Sunday with the Royals starting rookie LHP Will Smith, who pitched seven scoreless innings Tuesday in a victory at Minnesota. RHP Dan Haren will start for the Angels.
Stock Watch: Where all 30 teams stand for 2021 and beyond after epic MLB trade deadline
How did the wildest, most thrilling flurry of deals we've seen in ages change the fortunes of your favorite team?
Inside one of the wildest trade deadlines in MLB history -- and where season goes from here
From what shaped Jed Hoyer's strategy to how the Dodgers got their blockbuster deal across the finish line, here's how the biggest moves played out behind the scenes and what they mean for the rest of 2021.
Los Angeles fans give Houston Astros not-so-warm welcome at Dodger Stadium
More than a year of pent-up animosity spilled from the stands of Dodger Stadium onto the field as L.A. hosted the Astros on Tuesday night.
Gallen expected to start for the Diamondbacks against the Giants
San Francisco Giants (67-40, first in the NL West) vs. Arizona Diamondbacks (34-74, fifth in the NL West)
Allard scheduled to start as Texas hosts Los Angeles
Los Angeles Angels (53-54, fourth in the AL West) vs. Texas Rangers (39-68, fifth in the AL West)
Giolito scheduled to start as Chicago hosts Kansas City
Kansas City Royals (45-60, fourth in the AL Central) vs. Chicago White Sox (63-44, first in the AL Central)