Marian Gaborik scored a tying power-play goal with 12:04 left in regulation for the resilient Kings, who rallied from yet another deficit before finishing off the Rangers in the longest game in franchise history.
Jonathan Quick made 28 saves and Conn Smythe Trophy winner Justin Williams scored an early goal as Los Angeles added a second title to its 2012 championship, the first in the franchise's 47-year
After innumerable late chances for both teams in two nail-biting extra periods, Martinez popped home a rebound of Tyler Toffoli's shot. Martinez is becoming a late-game playoff legend after also scoring in overtime in Game 7 against Chicago in the Western Conference finals.
Chris Kreider scored a power-play goal and Brian Boyle added a tiebreaking short-handed goal late in the second period for the Rangers, who showed no nerves while facing elimination for the sixth time this spring.
Lundqvist stopped 48 shots in another standout performance for the Eastern Conference champions, but the Rangers repeatedly came up one goal short against the Kings despite their goalie's brilliance.
Martinez started the final rush with a pass to Kyle Clifford, who dropped it to Toffoli for a shot. The rebound went straight to Martinez, and the depth defenseman buried it for his fifth goal of the postseason.
"Fortunately, the rebound came to me and I was able to put it in," Martinez said. "The New York Rangers are a hell of a hockey team. We knew it was going to be a tough series."
The Kings gathered for a huge group hug near the Rangers' net, while coach Darryl Sutter nonchalantly walked onto the ice with almost no celebration.
Both teams had tantalizing scoring chances in overtime, but couldn't convert.
Ryan McDonagh hit Quick's post with a long shot during an early power play. Toffoli rang a shot off Lundqvist's post with 7:15 left, and the Kings trapped New York in its own end for an exhausting stretch late in the period.
Kreider got a breakaway in the final minute after Drew Doughty fell down, but he missed the net.
A few minutes after Carter's tip shot hit Lundqvist's post early in the second overtime, the Rangers put a tipped slap shot off Quick's post during their second fruitless overtime power play.
Rick Nash had an open net moments later, but Slava Voynov deflected the shot just high with the shaft of his stick.
In stark contrast to their rampage through the playoffs two years ago, the Kings earned this Cup with an incredible degree of difficulty.
Game 5 was the Kings' 26th playoff game of the spring, matching the NHL record for the longest postseason run. Los Angeles has played 64 playoff games over the last three years, setting another league record.
With Sutter and a solid veteran leadership group emphasizing consistency, the Kings have calmly handled everything the NHL could throw at them. After fighting through three straight seven-game series to emerge from the tough Western Conference, the Kings won the first three games of the finals, starting with consecutive OT wins at Staples Center on goals by Williams and captain Dustin Brown.
But New York staved off elimination with a 2-1 victory in Game 4 at Madison Square Garden, earning another cross-country trip.
Staples Center was packed well before the opening faceoff with fans eager for another celebration, rocking the arena with chants of "Go Kings Go!" while both teams were still in their dressing rooms.
Los Angeles started out with yet another big-game goal from Williams, who put the Kings ahead with his ninth goal of the postseason on a loose puck after linemates Dwight King and Jarret Stoll applied pressure on Lundqvist.
The Kings never led in their two overtime victories at home earlier in the series. But even after falling behind early, New York showed no semblance of nerves, largely outplaying the Kings in the first two periods.
The Rangers finally equalized when McDonagh found Kreider in front. Boyle then got a stunner after Carl Hagelin got the puck away from Voynov, skating around Doughty and wiring a pinpoint shot into the far top corner behind Quick with 29 seconds left for his third goal in 25 postseason games.
But the Kings showed the same determination that has characterized their entire spring run, and they finally equalized with Mats Zuccarello in the box.
Doughty's long shot hit Lundqvist in the chest and dropped in front of him before Gaborik alertly poked it between his legs for the 14th goal of a spectacular postseason by the Kings' newest acquisition.
NOTES: Both teams kept the same lineups from Game 4. Sutter never used D Robyn Regehr, who has recovered from his May 3 knee injury. ... The Kings never led in their two overtime victories at home earlier in the series. ... The 1987 Philadelphia Flyers and the 2004 Calgary Flames also played 26 postseason games, but neither won the Cup.