Scott Boehm, Getty Images
Derek Lee (center) is congratulated by Cubs teammates Jason Marquis (right) and Alfonso Soriano after Lee drove in the winning run in the 12th inning of Thursday's game against Milwaukee.

CHICAGO — Geovany Soto and the Chicago Cubs can almost taste the champagne after one of their sweetest and most improbable victories of the season.

Soto hit a tying three-run homer with two out in the ninth inning, Derrek Lee singled in the winning run in the 12th and Chicago beat the Milwaukee Brewers 7-6 on Thursday to move closer to the NL Central title.

The Cubs' magic number for winning their second straight division championship was reduced to two as they sent the Brewers to a crushing defeat.

"Wow," Soto said. "This year's been really, really crazy. I'm just here for one reason. I want to win and keep going."

Chicago was trailing 6-2 with two out and nobody on in the ninth, with just three hits to that point, before scoring four runs off closer Salomon Torres.

Now, the Cubs can clinch today if they beat the Cardinals at home and the struggling Brewers lose in Cincinnati.

"The beauty of baseball is you never know what is going to happen until that final out," Cubs manager Lou Piniella said. "It's uplifting to us and got to be deflating to the other team. ... Let's win tomorrow if we can and whatever happens on the road (to the Brewers) happens."

Milwaukee was on the verge of winning two of three at Wrigley Field and restoring some momentum under interim manager Dale Sveum.

Instead, the Brewers have dropped 13 of 17 during a skid that cost manager Ned Yost his job on Monday. Milwaukee has nine games left, but this will be a tough defeat to shake off.

"A real nice day kind of went haywire right away," Sveum said. "You're running out of games." It gets to the point, whatever the Mets do, you start thinking you have to win seven out of nine or eight out of nine. That's what it's getting to."

Pinch-hitter Daryle Ward led off the 12th with a walk and was replaced at first by Jason Marquis, who moved up on Reed Johnson's sacrifice. Alfonso Soriano was intentionally walked before Ryan Theriot flied out, sending Marquis to third.

Lee then singled to center off Carlos Villanueva (4-7), leading to a wild celebration.

"It shows the character of our team," Lee said. "All of a sudden in the ninth off a good closer we score four runs and like that's it a tie game. We kept chipping away and grinding it out."

Kerry Wood (5-4) pitched two innings, escaping a second-and-third, no-out predicament in the top of the 12th for the win.

National League

DODGERS 4, PIRATES 3 (12 INNINGS): At Pittsburgh, James Loney's line-drive single scored the go-ahead run in the 12th inning after Pittsburgh reliever Craig Hansen walked the bases full, and Los Angeles inched closer to winning the NL West. The Dodgers' magic number for winning the division is seven, in any combination of Los Angeles wins and Arizona losses. Scott Proctor (2-0) won it with a scoreless 11th inning and Jonathan Broxton finished for his 14th save.

METS 7, NATIONALS 2: At Washington, Johan Santana took a shutout into the seventh inning, Brian Schneider went deep twice for his first multihomer game in 5 1/2 years and the Mets beat the Nationals. Santana (14-7) improved to 7-0 with a 2.26 ERA over his last 14 starts. The Mets stretched their lead for the wild card to 1 1/2 games, thanks to Milwaukee's loss to Chicago. New York remained a half-game behind first-place Philadelphia in the NL East.

PHILLIES 4, BRAVES 3: At Atlanta, Pat Burrell hit a tiebreaking two-run homer in the sixth inning and the Philadelphia completed an unprecedented sweep of the nine-game season series in Atlanta. For the Philles, it was their season-best seventh straight win. Cole Hamels (14-9) gave up six hits and two runs in six innings to --> improved to 3-0 in four starts against the Braves this season. Brad Lidge pitched a perfect ninth for his 38th save.

MARLINS 8, ASTROS 1: At Miami, John Baker drove in four runs and scored two, leading Florida over Houston for its eighth straight victory. The Marlins are on their longest winning streak since they won nine consecutive in 2006 are tied with the Astros in the NL wild-card race, five games behind the Mets. Scott Olsen (8-10) allowed one run and three hits over seven innings to win his second straight start.

CARDINALS 5, REDS 4: At Cincinnati, Albert Pujols hit a three-run homer and Kyle Lohse won his first start since coming off a suspension as the Cardinals snapped a season-high, seven-game losing streak. Lohse (14-6) matched his career high for wins after serving a five-game suspension from Sept. 10-14 for throwing a pitch near the head of Reds pitcher Edinson Volquez — his opponent Thursday — on Aug. 17 at St. Louis. Volquez (16-6) lost for the first time in eight starts since Aug. 5.

DIAMONDBACKS 3, GIANTS 2: At Phoenix, Adam Dunn's two-out single in the eighth inning drove in the deciding run and gave Arizona a victory over San Francisco, dealing Tim Lincecum his first loss in two months. The Diamondbacks swept four games from the Giants to stay 3 1/2 games behind the first-place Dodgers in the NL West with 10 to play. Lincecum (17-4) was 6-0 in 10 starts since losing to Milwaukee 7-4 on July 20.

American League

TWINS 11, RAYS 8: At St. Petersburg, Fla., Alexi Casilla homered in Minnesota's five-run ninth inning and the Twins rallied for a victory over Tampa Bay, ending a four-game losing streak and pulling them within 1 1/2 games of the Chicago in the AL Central. Evan Longoria had three home runs for Tampa Bay, which had its AL East lead over idle Boston trimmed to 1 1/2 games. Eddie Guardado (4-4) pitched a scoreless eighth for the victory, and Joe Nathan worked the ninth for his 37th save.

YANKEES 9, WHITE SOX 2: At New York, Bobby Abreu homered twice and drove in six runs and Mike Mussina kept up his hopes for a 20-win season for New York. The AL Central-leading White Sox have lost seven of 11 and their division lead was cut to 1 1/2 games over second-place Minnesota. Mussina (18-9) earned his 268th win, tying Hall of Famer Jim Palmer for 33rd on the career list. He gave up one run and five hits in six-plus innings, and still has a chance for his first 20-win season with starts left at Toronto and Boston.

ANGELS 6, ATHLETICS 4: At Oakland, Calif., Kendry Morales, Mike Napoli and Brandon Wood hit consecutive home runs in a span of four pitches from Keith Foulke in the seventh inning for Los Angeles.

The AL West champion Angels avoided a three-game sweep. The Angels hit three straight homers for the first time since May 24, 2004, at Toronto, helping Joe Saunders (16-7) to his second victory in nine starts. Saunders pitched seven scoreless innings, allowed six hits, struck out four and walked three.

BLUE JAYS 3, ORIOLES 2: At Toronto, Jose Bautista homered in the first inning and pinch-hitter Gregg Zaun doubled home the tying and go-ahead runs in the sixth for Toronto. The last-place Orioles have lost 19 of 22 games and dropped their past nine series overall. Baltimore has gone 2-17 in its past 19 one-run games after starting the season 18-10 in such contests. Jesse Litsch (12-8) worked six innings to win for the third time in four starts allowing two runs and four hits. He walked four and struck out six.

B.J. Ryan survived a nervous ninth to earn his 31st save.

Baltimore went ahead in the fifth when Litsch walked the bases load and Alex Cintron hit a two-run single.

ROYALS 12, MARINERS 0: At Kansas City, Mo., Zack Greinke combined with two other pitchers on a three-hitter and Mike Aviles hit a three-run homer as Kansas City completed its first four-game sweep of Seattle in 19 years. It was the Royals' first four-game sweep of the Mariners since Aug. 17-20, 1989, in Seattle. Greinke (12-10) went seven-plus innings and struck out seven.