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
Shin-Soo Choo is lending aid to minor leaguers
Joon Lee reacts to Rangers outfielder Shin-Soo Choo donating $1,000 each to about 190 players in Texas' minor league system.
Shin-Soo Choo donating funds to Rangers minor leaguers
Veteran Shin-Soo Choo is giving $1,000 each to 191 players in the Rangers' farm system.
Can Major League Baseball be played in December?
Jeff Passan, Mark Teixeria and Eduardo Perez break down the possibility of the MLB postseason going into December.
DirecTV to carry Dodgers games on SportsNet LA
DirecTV has reached a deal to carry the Los Angeles Dodgers' network, SportsNet LA.
MLB cancels Cubs-Cardinals London series in June
MLB has canceled the London series between the Cubs and Cardinals due to the coronavirus pandemic.
From Mays to Trout: What lost career time means for the legacies of MLB greats
As the COVID-19 shutdown keeps today's biggest stars off the field, here's what Willie Mays, Ted Williams and other Hall of Famers show us about how it could alter baseball history.