OAKLAND, Calif. -- Matt Chapman was thinking slider, and he guessed right.
Chapman's 17th homer and second game-ender came on a 1-0 slider from Diego Castillo (1-5), handed his first blown save in eight chances.
"I knew he didn't have very good command of that fastball so I thought that he was going to try to sneak a slider in there and I was ready to hit," Chapman said.
Frankie Montas pitched eight innings of one-run ball for the A's, who rallied for their fourth straight win and seventh in nine games after Tampa Bay took a 4-1 lead with three in the top of the ninth.
"It was awesome. I'm still kind of shaking from it," Chapman said. "That was so much fun and that was just a really big win for us and an important one for sure."
Tommy Pham homered in the sixth for the Rays, who lost their fourth consecutive game and eighth in 10.
Robbie Grossman drew a leadoff walk from Castillo, and Jurickson Profar walked one out later. With two outs, Marcus Semien extended his hitting streak to 17 games with a run-scoring single before Chapman connected.
"It looked like (Chapman) had an approach where he was going to get a breaking ball, and he wasn't going to miss it," Rays manager Kevin Cash said.
Lou Trivino (3-5) got one out for the win. Profar hit a solo homer in the fifth to put the A's ahead.
Pham and Brandon Lowe drew consecutive walks from Oakland closer Blake Treinen to start the ninth. After a double steal, Avisail Garcia singled in the tiebreaking run and Ji-Man Choi followed with an RBI single.
Garcia scored on Willy Adames' sacrifice bunt to make it 4-1.
Rays starter Charlie Morton pitched 6 1/3 innings of four-hit ball. He gave up one run, struck out six and walked two.
Montas allowed four hits, struck out nine and walked none.
"I was feeling pretty good. I was able to command my fastball and my breaking pitches," he said.
Montas has struck out nine or more in three straight outings.
"I'm really not trying to strike out people," he said. "I'm just trying to get groundballs early. If I get two strikes, I try to put them away."
Profar's homer was just the seventh Morton has given up in 93 2/3 innings. ... Montas retired 18 of the last 19 batters he faced.
The Rays recalled RHP Austin Pruitt from Triple-A Durham and optioned LHP Adam Kolarek to their top farm club.
Rays: LHP Jose Alvarado threw a bullpen at the team's minor league complex in Port Charlotte, Florida. Alvarado was placed on the restricted list retroactive to June 2 after he went to his native Venezuela due to a family emergency. He isn't expected to go on a minor league rehab assignment. "Hopefully, we avoid that," Cash said. "Bullpens, maybe set up a (simulated) game, something like that. Obviously, the quicker the better. We need him. He would be a big boost for us when we get him back."
Athletics: Manager Bob Melvin missed the game due to a planned medical appointment to address neck and back pain. He is expected to return Friday. Bench coach Ryan Christenson took over as manager for the night.
Rays: Had not announced a starting pitcher for Friday.
Athletics: RHP Tanner Anderson (0-1, 3.27 ERA) threw 5 2/3 innings of three-hit ball in his first career start June 10 against the Rays. He gave up two runs.
More AP MLB: https://apnews.com/tag/MLB and https://twitter.com/AP-Sports
Nationals closer Daniel Hudson on paternity leave; to miss Game 1
Daniel Hudson's absence means the Nationals will be down a key reliever for at least Game 1 of the NLCS against the Cardinals.
Glasnow feels he tipped pitches in Game 5
Tyler Glasnow says he looked back on his pitching performance against the Astros and it was obvious that he tipped pitches.
Nats over Yankees? Re-ranking the final four playoff contenders
With the league championship series upon us, we break down the remaining teams and rank them on where they stand now.
MLB Playoffs Daily: What do Nationals, Cardinals have left in the tank?
Washington and St. Louis were taken to the limit in their division series. Now they regroup and square off in the NLCS.
LCS roundtable: Inside scoop on Nationals-Cardinals, Astros-Yankees
With four playoff teams left, here's what we've learned so far and what's coming next.
Yanks vs. Astros ALCS: The ultimate collision course
Buster Olney sifts through the stars that make up the last two teams standing in the American League, the Astros and the Yankees.