Christian Walker, Brice Matthews, Jake Meyers and Jose Altuve homered, and a ninth inning throwing error by Nick Loftin let Joey Loperfido score the go-ahead run as the Houston Astros edged the Kansas City Royals 8-7.