The Astros don’t just appear to be playing better baseball. They are.

A 3-1 victory against Kansas City on Wednesday at Minute Maid Park gave the Astros a series win versus the Royals and a 4-3 record in their last seven games.

Righthander Jordan Lyles guided the Astros (14-33). The 22-year-old threw six innings of six-hit, one-run ball, mixing a mid-90s fastball with a sharp slider and allowing only two extra-base hits. It was Lyles’ longest and best outing of the season.

“He definitely has the stuff. … When I sent him back out there for the sixth, I told him, ‘Ain’t nobody coming to get you.’ … He did a great job of getting us through the inning and turning it over to the bullpen,” Astros manager Bo Porter said.

Jason Castro was 3-for-4 with a double, and J.D. Martinez was 2-for-4 with two RBIs.

Kansas City’s James Shields struck out seven and gave up seven hits in seven innings. But the Royals righty was damaged in the first, when Martinez powered the Astros to a 2-0 lead by slicing a home run into the right-field stands on a 2-2 cutter.

Royals right fielder Jeff Francoeur answered losing a ball in the lights during the second inning — which resulted in a Carlos Pena double — with a triple to deep center field to lead off the third. Francouer was driven in when George Kottaras doubled to left-center, pulling the Royals within 2-1 and giving them a runner on second with no outs. Lyles struck out slugger Billy Butler on 11 pitches, though, stranding runners at first and third.