The Royals had enough of getting pushed around on their own turf by the Oakland Athletics. After back-to-back losses, their bats came alive and sparked the first win at home since Aug. 16.

Hunter Dozier and Ryan O'Hearn each belted home runs, and Nicky Lopez and Whit Merrifield each extended hitting streaks and scored runs as the Royals beat the Athletics 6-4 in front of an announced 15,049 at Kauffman Stadium on Wednesday night.

A win on Thursday would give the Royals a series split.

The Royals (47-87) didn't hold a lead through the first 24 innings of the series, but they scored two runs in the seventh inning against Athletics reliever Blake Treinen to break a 4-4 tie and pull in front after an RBI single by Dozier and a bases-loaded grounder that allowed Merrifield to score from third as the Athletics (76-56) turned a double play.

"He has a really good sinker," Dozier said. "He's a tough pitcher. I was just trying to get something good to hit and get the guy in from third any way I could."

Dozier's single through the left side of the infield resulted in his 23rd go-ahead RBI of the season, the fourth-most in the American League.

After having not been able to get a big hit when needed in the first two games of the series, the first four hitters of the seventh inning reached base.

"We've been facing some pretty good arms," Dozier said. "They've thrown the ball well over there. We did a good job when guys got on base tonight. That's kind of how baseball goes."

Left-hander reliever Tim Hill pitched two spotless innings to earn the win. He came in to start the seventh and didn't allow a hit out of the bullpen behind starting pitcher Jakob Junis.

"After I got through the first and they told me I was going back out for the second one, I took a look at who I had coming up," Hill said. "I see two lefties. That definitely gives you a little added confidence."

Ian Kennedy closed out the game with a scoreless inning to earn his 23rd save.

The Athletics jumped out to a two-run lead against Junis in the first inning after Marcus Semien's leadoff homer and a bases-loaded RBI groundout by Seth Brown.

"First inning I wasn't sure if he was going to make it through two," Royals manager Ned Yost said. "He really struggled to command the ball. Home run on a pitch that caught too much of the plate. He ended up hitting (Matt) Chapman in the head with a fastball, a walk, and I'm like, geez."

Junis settled in and held the Athletics to four runs on seven hits and one walk in six innings.

Dozier's third-inning home run - his first since Aug. 11 - tied the score 2-2.

In the fifth, Athletics center fielder Mark Canha lofted the first pitch of his at-bat high and deep to center field (it traveled an estimated 411 feet) for a two-run homer that gave the lead back to Oakland.

The Royals got a run back after an infield single by Merrifield, which extended his hitting streak to 10 games, and a one-out RBI double to left field by Jorge Soler. O'Hearn's sixth-inning homer, his 10th of the season, tied the score 4-4.

That set the stage for the Royals to take the lead in the seventh.

The teams will conclude the four-game set on Thursday afternoon. Right-hander Glenn Sparkman (3-9, 5.52) gets the start for the Royals, while right-hander Chris Bassitt (9-5, 3.59) will start for the Athletics.