KANSAS CITY, Mo. — The Giants are going in one direction and the Kansas City Royals in another.

James Shields threw a four-hitter and Alex Gordon homered as the Royals won their sixth straight, beating the Giants 5-0 on Saturday night.

The Royals have won nine of 10 to move with 11/2 games of AL Central-leading Detroit. The Royals, who have not made the playoffs since beating St. Louis in the 1985 World Series, are in second place in the AL wild card standings.

On the flip side, the Giants have lost 34 of their past 54 games, a .370 winning percentage, the third-worst in the majors in that span. On June 9, the Giants were a major league-best 42-21 with a 9½-game lead in the NL West.

They trail the first-place Los Angeles Dodgers by 3½ games after the Saturday loss They are in a virtual tie with Pittsburgh and St. Louis for the top spot in the NL wild card standings.

“We’re in a position to make a run and if you’re in the playoffs anything can happen,” Giants catcher Buster Posey said. “We know we can win games against good teams. If we get hot down the stretch anything can happen.”

Is it too early to be thinking about the Dodgers, Pirates and Cardinals?

“We have a little under 50 games left and we’re focusing on trying to play solid baseball, so ask me that a little later,” Posey said.

Tim Hudson (8-9) gave up a home run to Gordon to lead off the fifth inning.

The Giants have lost seven of their past eight games against AL clubs.

“We have to keep pushing and stay positive,” Giants manager Bruce Bochy said. “They’re playing very well. When you play good teams you have to play your best ball. Last night we let it get away. Tonight we just ran into a well-pitched game.”

Hudson yielded three straight hits to start the four-run seventh and was replaced by Jeremy Affeldt.