Omar Gonzalez tied it in the 61st minute with a long header for the Galaxy, who defended their title in a rematch of last season's championship game. For the second straight year, Beckham raised a trophy that stands as evidence of the 37-year-old English midfielder's indelible impact on American soccer during his six seasons in Los Angeles.
"It's been a successful six years here, and now that we've won the second one, it's even more satisfying," Beckham said. "I just hope people have enjoyed me playing here. It's what I always hope for when I step on the field."
With a stirring second-half surge capped by Robbie Keane's goal on another penalty kick in injury time, Los Angeles won its fourth MLS Cup, tying D.C. United for the league record.
The Galaxy also gave an appropriate farewell to Beckham, who will play elsewhere in the new year before eventually returning to MLS as a team owner. With rumors linking him everywhere from Sydney to Paris, he hasn't disclosed his immediate plans beyond a Christmas vacation back home in England.
Los Angeles will miss Beckham, but the glamorous global icon is going out at an apex for MLS' highest-profile franchise.
"I just hope I've brought a bit of interest to the game in America," Beckham said. "If that's the single thing I've done, then great."
After Calen Carr put Houston ahead in the 44th minute, Beckham and his high-scoring teammates systematically broke down the defense of the Dynamo, who lost the MLS Cup 1-0 to Los Angeles on the same field last year.
Keane played another stellar attacking game for Los Angeles before earning his own penalty kick when Houston's Tally Hall knocked him down in the box, while Gonzalez got the equalizer on a cagey play by MLS' top defender last season.
Moments later, Donovan redeemed himself for missing an open net in the 13th minute by burying his penalty kick after a Houston handball in the box. The U.S. national team star, who is also contemplating a departure from soccer, won his record-tying fifth MLS title while scoring his fifth career MLS Cup goal and the record 22nd goal of his postseason career.
"It's a little surreal," Donovan said. "In any sport, to repeat is really hard to do. ... For me personally, this felt more satisfying [than last year]. We could enjoy it a little bit more."
After Keane's goal clinched it, Beckham left the game to a raucous standing ovation from the packed stadium amid chants of "Thank you, David!"
Beckham hugged Galaxy coach Bruce Arena, who won his fourth MLS title, and just about everybody on the Galaxy bench before the game ended moments later.
Beckham streamed onto the field with his teammates and waved thanks at the fans before he was joined by his three sons, all clad in No. 23 Galaxy jerseys.
"Today was always going to be an emotional day for myself, win or lose," said Beckham, who also won trophies in his final seasons at Real Madrid and Manchester United. "Coming off was tough, but I enjoyed the win today."
The pregame rain cleared long enough for MLS' sunny farewell to Beckham, who arrived in Los Angeles in 2007 from Real with designs on changing the American perception of the world's most popular game. The league has grown steadily during his tenure, with most MLS franchises on sound financial footing and in excellent stadiums, although the sport's popularity and TV ratings haven't matched the other American pastimes.
Beckham was wildly cheered by many of the same diehard Galaxy supporters who booed him three years ago after his loans to AC Milan and an injury-riddled start to his Galaxy career. The Home Depot Center souvenir stands were loaded with Beckham shirts, including one that said "Take Me With You!"
These two franchises have combined to win eight of the last 12 MLS titles, dating back to the Dynamo's days in San Jose. Houston seems stuck as a supporting player in the Galaxy's story, despite its rally from the Eastern Conference's last playoff seed to the championship match.
"You have to be proud of what we've accomplished once again," Houston captain Brad Davis said. "It isn't easy to get to this game, and this is the fourth time in seven years. It's a credit to this group of guys."
After winning the title last year on a Beckham-to-Keane-to-Donovan beauty of a goal, Los Angeles nearly had another storybook goal in the 13th minute when Beckham launched a long, high pass to a sprinting Keane, who slipped behind the defense and centered it perfectly for Donovan.
But he inexplicably pushed his shot inches wide of the post, leaving him with both hands on his head while the stadium released the usual post-goal confetti anyway.
"When you're in a moment like that, you feel like you let the team down," Donovan said. "Candidly, it sat with me until halftime."
The Dynamo improved their pressure late in the first half, and Adam Moffat's long pass eventually set up Carr's impressive near-post goal past Josh Saunders.
Carr leaped the corner flag in celebration of a rare score for the forward, a Bay Area native who joined the Dynamo last season and managed just four goals this year.
But with Keane and Beckham leading the second-half charge, the Galaxy finally broke through when Gonzalez stuck around the box after a failed setpiece and managed to bounce a looping header past Hall. Gonzalez was MLS' top defender last year, and his late return from injury this season sparked the Galaxy's late-season surge.
"At the beginning of the season, I didn't see myself getting back to this level," said Gonzalez, named the game's MVP.
Ricardo Clark was then called for a handball in the box in the 65th minute after an extended defensive scramble by the Dynamo. Donovan squatted down to prepare for his penalty kick before burying it in a back corner.
Houston frantically pressed for an equalizer in the final minutes, but Saunders and his defense repeatedly denied the Dynamo. After Hall wrapped his hand around Keane's thigh to stop a chance in the box, Keane confidently scored his sixth goal of a spectacular six-game postseason run in the Irish national team captain's first full MLS season.
Galaxy 3, Dynamo 1
R David Beckham concludes his six-year MLS career with a second straight championship.
• After Calen Carr gives Houston the lead in the 44th minute, Omar Gonzalez ties it with a header in the 61st.
• Landon Donovan scores a PK in the 65th, and Robbie Keane adds one in stoppage time.