CHICAGO — It’s down to the last couple days of July, and the Kansas City Royals have an equal amount of wins and losses.

It’s a small step, but it’s somewhere to start.

Alex Gordon hit a two-run homer in the 12th inning and the Royals beat the Chicago White Sox 4-2 on Sunday for their sixth consecutive victory.

“This is a lot of fun,” Gordon said. “We have a lot of guys that are playing well and picking each other up and just a good team right now.”

Kansas City (51-51) matched its longest winning streak of the season and got back to .500 for the first time since it beat Cleveland 2-1 on June 17 to improve to 34-34.

It’s the best record for the Royals this late in the year since they finished the 2003 season with an 83-79 mark, according to STATS.

“To get here was big,” manager Ned Yost said. “Now we got to get past it and just stay focused day to day.”

With no outs and Jarrod Dyson on third in the 12th, the White Sox brought their infield in, but it didn’t matter one bit.

Gordon drove a 2-2 pitch from Donnie Veal (1-1) over the wall in center for his first homer since July 7 and No. 10 on the year.

Gordon went 1-for-6 and is batting .121 (4-for-33) over his past eight games, but it hardly mattered to him after coming up with the clutch swing.

“One hit’s fine with me as long as it wins the game,” the All-Star outfielder said.

Aaron Crow (7-3) tossed a scoreless inning to get the win and Greg Holland finished for his 27th save in 29 chances. Holland has converted each of his past 20 opportunities.

The White Sox had a chance to win the game in the 10th, but Dyson threw out pinch runner Blake Tekotte at the plate to end the inning. Tekotte was trying to score from second on Alejandro De Aza’s sharp single to center field.

Adam Dunn homered for last-place Chicago, which closed out a 3-7 homestand with its ninth loss in 12 games overall. Paul Konerko also had an RBI single.

The White Sox had three runs and 21 hits in the series sweep.

“I think pitching-wise, our guys gave us every opportunity,” manager Robin Ventura said. “We just didn’t come up with much. That’s frustrating and all that stuff going with it. Just has to be better if you’re going to win games.”

David Lough, who made a terrific catch in the ninth inning of Kansas City’s 1-0 victory on Saturday night, helped the Royals get off to a fast start in the series finale. He singled in Alcides Escobar with two out in the first, then walked and scored on Miguel Tejada’s double in the fourth.

Dunn responded in the sixth, driving a 1-1 pitch from Bruce Chen over the wall in center to tie it at 2. It was Dunn’s 25th homer of the season and No. 431 for his career, tying Cal Ripken for 43rd on the all-time list.

Dunn also helped set up Chicago’s first run with a two-out walk in the first that moved Alex Rios into scoring position. Konerko followed with a run-scoring single into left field.

Chen allowed three hits, struck out five and walked two in six innings. The crafty left-hander is 1-0 with a 1.50 ERA in three starts since joining the rotation.

“It’s one of those things. You want to help the team in any way you can,” said Chen, who is 4-0 with a 2.09 ERA in 22 appearances on the year, “and I’m glad that I was able to help this team and we got the victory today.”

“Yeah, it’s just been the story the whole year,” Santiago said. “Try to keep us in the game and keep it close enough where we have a chance and for the most part that’s what we did.”

Notes: Kansas City is 7-1 in extra-inning games this season, including a 4-0 mark on the road. ... White Sox RHP Jake Peavy brought a couple of big suitcases into the clubhouse before the game. He is scheduled to start Tuesday in Cleveland, but he also is one of the top pitchers on the market ahead of Wednesday’s non-waiver trade deadline. “I don’t think he wants to go. I don’t want him to go,” Ventura said. “But he has to be prepared. That’s part of where we’re at right now.” ... Royals CF Lorenzo Cain got the day off after he left Saturday night’s 1-0 win with tightness in his left groin. Kansas City is off Monday before beginning a three-game series at Minnesota, allowing Cain to rest for consecutive days. ... Chicago begins a four-game series against the Indians tonight. White Sox LHP John Danks (2-8, 4.81 ERA) opposes RHP Zach McAllister (4-6, 3.57 ERA) in the opener. ... Royals RHP Ervin Santana (6-6, 3.06 ERA) faces RHP Mike Pelfrey (4-8, 5.15 ERA) on Tuesday in Minnesota.