The Houston Astros blared Michael Jackson hits and were feeling celebratory vibes on Sunday after snapping a skid with another extra innings win.

Jake Marisnick hit a tying home run off Kelvin Herrera in the ninth inning and Evan Gattis drew a bases-loaded walk from Matt Strahm in the 12th, helping the Astros beat the Kansas City Royals 5-4 Sunday and stop a three-game losing streak.

It was Houston's second walk-off win in five days following a 13th-inning three-run homer from George Springer in a 5-3 victory over Seattle on Wednesday.

"I love this team and I love our character, our grind," Astros manager A.J. Hinch said. "We don't work at all cylinders all the time, and I think we showed that this week and still came out with a winning homestand. Whatever words — grit and grind and character — the guys are into it."

Brian McCann walked on 10 pitches, and Gattis took a high-and-inside, full-count pitch for ball four. Gattis said he had never ended a game with a walk before, but he credited Marisnick's homer as the bigger swing in momentum for the team.

"The Marisnick home run was huge," Gattis said. "It really breathed life back into us and it was good to get a win."

Marisnick's homer sneaked into the first row of the left field Crawford Boxes near the foul pole. He said he wasn't sure it had enough to top the yellow line when he hit it.

"I honestly couldn't see it," Marisnick said. "I hit it right into the lights and I didn't know where it went. I knew I hit it good with a little topspin. Luckily, I got enough of it."

Springer hit his 12th leadoff homer in the first and third in seven games this season.

Brandon Moss homered against Chris Devenski (1-0) in the ninth to give the Royals a 4-3 lead.

Springer reached on an infield single leading off the 12th against Strahm (0-2), Alex Bregman sacrificed, Jose Altuve was intentionally walked and Carlos Correa hit into a forceout that advanced Springer to third.

Devenski struck out seven in four innings, allowing one run and three hits. Devenski became the second reliever in MLB history to start a season with consecutive outings of four or more innings with seven or more strikeouts, joining Liam Hendriks (2013).

"I'm going to run out of ways to describe Chris Devenski's performances when he comes in like this," Hinch said. "His pitch repertoire is perfect for these types of situations. He's not going to go four innings and 60 pitches every outing, but he's as valuable as any play that happened in the game today. Chris Devenski is exceptional."

The Astros, who started 3-0 for the first time since 2001, moved back over .500 at 4-3.

Nathan Karns, making his first start and second appearance for the Royals, gave up one run and six hits in 5 2/3 innings. Karns was acquired in an offseason trade from Seattle for outfielder Jarrod Dyson.

"I thought he did a great job," Royals manager Ned Yost said. "First two innings were a little erratic, gritty, but he settled down in the third and pitched great from that point on."

Astros starter Lance McCullers struck out 10 in seven innings, allowing three runs and six hits.

Salvador Perez tied it in the second when he became Kansas City's first player to homer in four straight games since Billy Butler in 2011. The franchise record of five was set by Mike Sweeney in 2002.

Paulo Orlando avoided McCann's tag to score on Raul Mondesi's bunt in the fifth, and Mike Moustakas homered in the sixth for a 3-1 lead. Marwin Gonzalez's two-run homer off Travis Wood tied the score 3-3 in the seventh.

UP NEXT

Royals: RHP Ian Kennedy (0-1) is to start Kansas City's home opener against Oakland on Monday. Kennedy lost at Minnesota last week, allowing three runs, three hits and five walks in five innings.