Lee hit a two-run drive in the first inning off Chad Billingsley (4-6) for his 250th home run, and Ramirez added a solo homer against Scott Proctor in the eighth.
That was enough for Dempster, who's making a case for an All-Star selection after being converted back to a starter.
"Nothing's easy about it," he said. "It's been hard work."
He's making it look easy.
Dempster (6-2) gave the bullpen some rest after the Cubs combined to use 11 relievers in consecutive extra-inning losses at Pittsburgh. He allowed one run and seven hits in seven innings before Bob Howry and Kerry Wood finished.
Dempster gave up a run-scoring infield single to Juan Pierre in the fifth and escaped a bases-loaded jam in the sixth. After a visit from pitching coach Larry Rothschild., Dempster struck out Blake DeWitt on a check swing and retired Luis Maza on a flyout.
Chicago had no one warming up in the bullpen, so the Cubs were counting on Dempster to escape.
"I think early in the season I'm showing them that I'm strong enough to keep going and bounce back," Dempster said. "I'd like to think I've got as good a chance in that situation as anybody."
The Dodgers had another chance in the eighth when they loaded the bases against Howry on Jeff Kent's single, Matt Kemp's double off the wall in right with one out and Blake DeWitt's intentional walk.
Pinch-hitter James Loney just missed a grand slam when he lined a foul down the right-field line, Loney then struck out, and Delwyn Young hit an inning-ending flyout.
Andre Ethier singled with one out in the ninth, but Wood struck out Russell Martin and Chin-Iung Hu for his 11th save in 15 chances. Los Angeles stranded 12 runners.
"It was frustrating, no question," manager Joe Torre said. "We were in position to tie the game a number of times and win the game there in the eighth inning."
Instead, the Dodgers wasted another solid outing by Billingsley.
He allowed two runs and four hits in six innings, struck out seven and walked two after going 4-1 in his previous five starts. He thought he made a good pitch to Lee after Theriot walked in the first.
"With Derrek, the ball wasn't where I wanted it, but it wasn't that bad of a location - up and in," Billingsley said. "He didn't get good wood on it, but he got it up in the air, and he got it out."
That was just enough for the Cubs, who were coming off two difficult defeats at Pittsburgh that included late mistakes by Alfonso Soriano.
He was picked off second base in the ninth inning of a 5-4, 14-inning loss, then dropped a flyball for a double in the ninth inning the following day as Chicago fell 6-5 in 11.
Bothered by leg problems the past two seasons, Soriano couldn't make it past second on Ryan Theriot's single to right in the sixth inning Monday and stopped at third on Ramirez's hit to right with one out.
That loaded the bases for Kosuke Fukudome, who sent a hard bouncer to the mound that Billingsley speared before throwing home to start an inning-ending double play.
Soriano said his legs are fine and that he had to hold up on those hits.
"I could not go to third on Theriot's single because there was nobody out, and the right fielder (Ethier) has a good arm," he said. "On Aramis' base hit, there was one out. I didn't know if the right fielder was going to catch the ball, so I stayed in between. It's very difficult to score on that play."
Notes: Kent had three hits, his first multihit game since he went 2-for-5 against Colorado on May 2. ... Ethier is 11-for-30 in his last seven games after collecting two hits. ... Cubs manager Lou Piniella won't consider removing Soriano for a defensive replacement, even though he's made several costly miscues in the late innings. "The ball was right in the sun," Piniella said before Monday's game. "Let's just leave it at that and go forward."... The Cubs are the only major league team that has not lost more than two in a row. ... The Cubs observed a moment of silence before the game for former pitcher Geremi Gonzalez, who was killed by a lightning strike in his native Venezuela on Sunday. He won 11 games for Chicago in 1997.