Updated

J.D. Martinez hit a two-run homer and Jordan Lyles pitched six frames of one-run ball, as the Houston Astros defeated the Kansas City Royals, 3-1, to take the rubber match of a three-game series at Minute Maid Park.

Lyles (2-1) gave up six hits and a walk in his outing, while Jose Veras pitched a flawless ninth to notch his eighth save.

Jason Castro was 3-for-4 with an RBI for Houston, which has won its first series against Kansas City since taking two of three June 17-19, 2005.

"Pitching staff made it easy. They came out and did a tremendous job," Castro said.

George Kottaras drove in the lone run for the Royals, who had lost four straight one-run games before defeating Houston on Tuesday.

Kansas City starter James Shields (2-5) allowed two runs and seven hits while striking out seven in seven innings.

"We're putting a good effort out there," Shields said. "That's all you can really ask for and obviously the results aren't there."

Castro singled with one out in the first, setting up Martinez's two-run blast.

In the third, Jeff Francoeur tripled to lead off. Kottaras then ripped a double to center, scoring Francoeur, to cut the deficit to 2-1. Chris Getz grounded out but allowed Kottaras to reach third, giving the Royals a chance to tie the game.

However, Alcides Escobar grounded out to third, and after Alex Gordon drew a walk, Billy Butler struck out to end the inning.

The Royals mustered just three more hits and were only able to get one other runner in scoring position.

Houston added an insurance run in the eighth. With two outs, Jose Altuve drew a walk, stole second, and scored on a double by Castro.

Veras pitched a 1-2-3 ninth to end the game.

Game Notes

Opponents are just 1-for-33 against Veras in his last 11 appearances. He has not allowed a hit in his last seven games ... Lyles made his 50th career appearance ... The Royals came into the game 3-0 in rubber matches, all on the road.