KANSAS CITY, Mo. — The Yankees have spent the past week playing the two worst teams in the American League — and they’ve taken advantage of the favor the schedule-makers gave them.

On Saturday, they swept a split doubleheader against the Royals, winning the first game 7-3 and the nightcap 6-5 at Kauffman Stadium. The victories gave the Yankees a season-high seven-game winning streak.

So while their AL East foes tread water, with the Red Sox facing the Astros and Tampa Bay plays Cleveland, the Yankees have taken command of the division on Memorial Day weekend with 11 wins in their past 12 games.

“It was a long day,’’ manager Aaron Boone said. “To rack up two more wins, you take it. It’s not a perfect night for us, but to hang on and pull out another victory is big.”

To Boone’s point, J.A. Happ allowed a game-tying three-run homer in the opener and they played shoddy defense in the outfield in the nightcap, but it hardly seemed to matter against another woeful opponent.

Happ was masterful for five innings in the first game before Kansas City’s Whit Merrifield hit a three-run homer in the bottom of the sixth to tie the game.

Despite the blow, the Yankees remained confident they’d still find a way to win.

“One hundred percent,’’ Luke Voit said. “It doesn’t matter if I’m hitting or Gary [Sanchez], Gleyber [Torres], whoever. I feel like someone will hit a home run or drive in a big hit.”

Voit answered Merrifield’s homer with a 470-foot blast for a two-run homer in the seventh. The home run was followed by Thairo Estrada’s two-run double in the eighth, as they continue to feast on awful competition.

The offense helped make a winner out of Happ, who was coming off his worst start of the season, when he allowed six runs in just 3 ²/₃ innings to the Orioles.

On Saturday, he allowed just a bloop single to Merrifield in the first before retiring 15 in a row. In six innings, he struck out 10 and didn’t walk a batter.

He faltered in the sixth, when Billy Hamilton reached on a bunt hit and Nicky Lopez singled to left before Merrifield took Happ deep.

“I’m responsible for that,’’ Happ said. “I was the one that threw it. A bunt, a slap through the hole and I threw a ball at [Merrifield’s] shoulders and he hit it out. It is on me and I accept that, bBut as far as how I threw the ball, I felt I pitched better than the results.’’

In the nightcap, Chad Green served as the opener for a second straight appearance and again, the results were less than ideal, as he gave up a run in the first. Alex Gordon was thrown out at the plate to end the inning.

The Yankees responded in the second with five runs off Jorge Lopez, with a two-run single from Austin Romine followed by a two-run double by Cameron Maybin. Lopez was knocked out before he recorded an out in the second.

Chance Adams, called up from Triple-A Scranton/Wilkes-Barre as the 26th-man for the second game, entered in the second and gave up three runs in four innings — betrayed by his outfielders.

The Royals scored a run in the third after Gardner dropped Adalberto Mondesi’s fly ball to center, allowing Merrifield to come around from first.

Gardner and Frazier had more misadventures in the fourth, costing the Yankees another run.

The two outfielders lost what should have been a routine fly ball by Dozier and it fell for a double.

“That’s happened to me one other time in Detroit a long time ago,’’ Gardner said. “I completely lost it after it got out of the infield. Just the time of day, dusk I guess.”

Jorge Soler followed with a fly ball toward the right field corner and Frazier couldn’t get to it, scoring Dozier. Cam Gallagher singled to right to make it 6-4.

After Jonathan Holder, Tommy Kahnle and Zack Britton pitched scoreless innings, Aroldis Chapman gave up a run in the ninth before he fanned Gore to end it.

“It was a little more interesting than I wanted,” Chapman said through an interpreter.

But the Yankees will take the wins — and a season-best three-game lead over the Rays in the division.