Bob Melvin had just burned through his bullpen to win a nip-and-tuck shootout against Kansas City on Thursday, and the Oakland A's manager leaned back in his chair and asked ruefully: "How many relievers did the Yankees use today?"

He was joking, of course. Melvin knew full well that New York had the day off before the two AL playoff contenders open a weekend series at Yankee Stadium on Friday night.

Melvin probably wouldn't have been joking had the A's lost to the lowly Royals.

"We had to have this game," he said after the 9-8 victory at Kauffman Stadium. "When you go through your entire bullpen and then go to Yankee Stadium – we had to win that game."

Jurickson Profar set the tone with a homer and three RBIs, but everyone in the A's starting lineup had a hit or drove in a run. That allowed them to bail out starter Chris Bassitt, who failed to survive the fifth inning, and give Yusmeiro Petit (4-3) the opportunity to earn the win.

Fellow relievers Jake Diekman and Liam Hendriks didn't make it easy, though. They gave up back-to-back RBI singles in the eighth, then Hendriks gave up a two-out RBI single to Ryan O'Hearn in the ninth, before the former Royals reliever bounced back to strike out Bubba Starling and earn his 17th save.

"Wasn't my best outing of the year," Hendriks said. "We're not scoreboard-watching or anything like that, but you take three of four from any series and you're going to be OK."

The A's added a run in the ninth – and it proved to be the deciding run – when Corban Joseph popped foul with one out and runners on second and third, and Cuthbert made a nifty catch falling into the third base dugout. But under Rule 5.06(b)(3), both runners are entitled to advance a base, sending Seth Brown home from third.

"I was holding onto the rail as much as I could," Cuthbert said, "but I couldn't (stay in play)."

Glenn Sparkman (3-10) also failed to make it through the fifth for Kansas City, allowing seven runs, nine hits and a walk. He also hit two batters in losing his fifth straight decision.

"He struggled with command. He got hurt on pitches that were center-cut," Royals manager Ned Yost said. "That's a really good offensive team. You look at their home run numbers and if they get a pitch they're going to drive it deep somewhere."

Sparkman gave up a game-opening single to Marcus Semien, another hit to Matt Olson and plunked two batters – one of them sending home a run – in staking Oakland to a 1-0 lead after the first.

Bassitt served up a leadoff since to Whit Merrifield, then let Jorge Soler drill a 1-0 pitch out of the park. The homer was the 37th of the year for the slugging Soler, moving him within one of matching Mike Moustakas for the single-season franchise record.

Sparkman breezed through a perfect second and third before making a mess of everything else.

Profar went deep and Josh Phegley had an RBI single during the A's three-run fourth, then Oakland tacked on three more runs off Sparkman and reliever Josh Barnes to take a 7-2 lead in the fifth.

Bassitt nearly gave it all back. Over the span of five batters in the bottom half, the right-hander plunked one, gave up a single to another, was victimized by an error and walked the bases loaded. Then, with the bases loaded, Cheslor Cuthbert came within a foot of hitting a tying grand slam — he wound up with a two-run double instead that drew the Royals within 7-5.

Oakland tacked on another run in the sixth before the Royals got within 8-7 in the eighth. Soler came to the plate with the go-ahead run on first but Hendriks struck him out to preserve the lead, then the Australian reliever made it through a shaky ninth inning to wrap things up.

A's call-up

Infielder Sheldon Neuse was called up by the Athletics to replace Khris Davis, who is on paternity leave. The 24-year-old Neuse hit .317 with 27 homers for Triple-A Las Vegas.

Chapman out

A's third baseman Matt Chapman was not in the starting lineup after taking a pitch off his helmet from the Royals' Jakob Junis in the first inning Wednesday night. He entered as a defensive replacement in the ninth.

Up next

Left-hander Brett Anderson (10-9, 4.08 ERA) takes the mound Friday night when Oakland visits the Yankees to start a three-game set between playoff contenders. Eric Skoglund (0-0, 3.60) makes his second big league start this season when the Royals host Baltimore starting Friday night.