CHICAGO -- Although he didn't think the Kansas City Royals were throwing at him intentionally, Tim Anderson still took pleasure in scoring a measure of revenge.

Six innings after being beaned with a pitch from Kansas City starter Glenn Sparkman, Anderson doubled in the go-ahead run in the eighth, lifting the Chicago White Sox to an 8-7 victory over the Royals on Wednesday night.

Sparkman struck the bill of Anderson's helmet in the second with nobody out, a runner on first and the White Sox leading 2-1. Anderson's helmet was knocked off his head, and plate umpire Mark Carlson immediately ejected Sparkman.

It was Anderson's first at-bat of the series. He had appeared as a pinch runner on Tuesday.

Last month, he was hit by Kansas City's Brad Keller in the backside after an elaborate bat flip on a home run in his previous at-bat. That sparked a benches-clearing scuffle. Keller was suspended five games and Anderson for one.

"I think it was just bad timing," Anderson said of Sparkman's pitch. "But it happened, and I was able to get the hit to win the game. It was payback. It felt good, man."

Sparkman was making his second start of the season.

"Coming into this series, we had no animosity toward that young man," Royals manager Ned Yost said of Anderson. "None. And to think that we're gonna hit him on purpose is ludicrous, one, and two, it was a changeup.

"It was forgotten. He had done his part, we had done our part. It was over."

Carlson, talking to a pool reporter, said last month's incident was a factor in the decision.

"We were aware of a previous situation between the two clubs involving Tim Anderson," he said. "When the pitcher threw the ball up and in and hit him in the head, that raises an awareness to us and we have to make a decision on what we want to do to handle that situation."

The Associated Press contributed to this report.