PHOENIX -- The Arizona Diamondbacks nearly snatched another improbable win before heading to the playoffs.
But Matt Kemp grabbed a piece of Dodgers history.
Kemp hit a two-run homer to become the first Dodger in 70 years to lead the NL in home runs and RBIs, and Los Angeles had to withstand another late-inning grand slam to beat the playoff-bound Diamondbacks 7-5 on Wednesday night.
A night after blowing a five-run lead in the 10th inning, the Dodgers held on before heading home while the Diamondbacks take off for Milwaukee and the NL division series.
"I'm glad it didn't end like last night, that's for sure," Dodgers manager Don Mattingly said.
It didn't matter to the Diamondbacks that it didn't.
Arizona locked up its NL West title last week, but lost its chance to host the first two games of the NLDS when the Brewers beat Pittsburgh.
Still, the Diamondbacks weren't ready to concede anything to the Dodgers.
Quiet early in the season finale, Arizona roared back for the second straight night, pulling within two runs in the ninth inning on Cole Gillespie's grand slam off Ramon Troncoso and Henry Blanco's solo shot.
Kenley Jansen ended the rally, getting the final two outs for his fifth save, but the Diamondbacks had a more important issue on their minds: Game 1 in Milwaukee on Saturday with ace Ian Kennedy expected to pitch.
"It's good to finally know who we're playing," Diamondbacks manager Kirk Gibson said. "It's the next step, we're going to be ready."
The Dodgers were pretty much out of the division race by the All-Star break and finished 82-79. They could be busy during postseason awards, though.
Kemp had one of the best seasons in Dodgers history and is a leading candidate for MVP honors. He hit his 39th homer in the seventh inning to pass Milwaukee's Prince Fielder for the league lead and finished with 126 RBIs, second-most in Los Angeles Dodgers history to Tommy Davis' 153 in 1962.
Kemp also led the league in runs, finished third in batting at .324 and became the 13th player in major league history -- and the first Dodger -- with 30 homers and 40 steals.
Dolph Camilli was the last Dodger to lead the league in homers (34) and RBIs (120) on his way to the 1941 NL MVP award.
Left-hander Clayton Kershaw has a good shot at the NL Cy Young Award, too, after leading the league with a 2.25 ERA and 248 strikeouts while matching Arizona's Kennedy for most wins with 21.
Dodgers infielder Eugenio Velez also made history, but not in a good way. He grounded out as a pinch hitter in the eighth inning to set a modern-day record for non-pitchers with his 46th straight hitless at-bat.
Velez had been tied with Pittsburgh's Bill Bergen (1909), Dave Campbell of San Diego and St. Louis (1973) and Milwaukee's Craig Counsell (this season).
In other words, plenty of bad to go with the good for the Dodgers in a season clouded by a bankruptcy filing and owner Frank McCourt's troubles.
"We accomplished a lot of things in these past two months," Kemp said. "We showed we could really play and beat some great teams and beat some great pitchers, too. It's all about starting out strong and finishing strong."
Arizona put together an unexpected turnaround season, following two 90-loss seasons by winning 94 games on the way to its first NL West title since 2007. The crowning moment came with Friday's division-clinching win, a bubbly infused celebration that spilled over into the pool behind the outfield wall in right field.
But there was still some work to do after the splash bash: catch Milwaukee for the NL's second-best record.
Arizona kept pace with a thrilling win over the Dodgers on Tuesday, when Ryan Roberts hit a walk-off grand slam to cap a six-run 10th inning after the Dodgers went up five in the top half.
Arizona became the second team in major league history -- with the Pirates in 1991 -- to win after falling behind by five or more runs in an extra inning, according to information provided to the Diamondbacks by the Elias Sports Bureau.
After all that excitement, the Diamondbacks didn't seem to have much left with the scoreboard showing the Brewers well on their way to a 7-3 win over Pittsburgh to secure home-field advantage for the NLDS.
Arizona managed three hits in seven innings against Ted Lilly (12-14) and Diamondbacks starter Joe Saunders 12-13) allowed five runs and nine hits before leaving after six innings -- with most of his teammates.
The atmosphere changed quickly late -- again -- when Gillespie hit his grand slam and Blanco followed with the homer that chased Troncoso. Arizona couldn't complete the comeback this time, with Jansen getting Sean Burroughs and John McDonald to fly out, but the Diamondbacks were more interested in looking ahead than behind.
"It should be fun," Diamondbacks center fielder Chris Young said. "We played good games against those guys all year and I'm sure it'll be exciting to watch."
Arizona led the majors with 501 extra-base hits. ... Roberts became the fourth player in history to hit an extra-inning grand slam with his team trailing by three or more runs with his shot against the Dodgers on Tuesday, according to Elias. Babe Ruth, Roger Freed and Jason Giambi were the others. ... Due to a rainout in Washington, the Dodgers failed to play 162 games in a non strike-shortened season for the first time since 1989. ... Velez's last hit was a 12th-inning single off Cesar Ramos on May 18, 2010, against San Diego while playing for the Giants.