SAN ANTONIO (AP) -- The Memphis Grizzlies ended years of frustration in San Antonio, and had to play late into the night to do it.
Marc Gasol scored 26 points, including a banked-in 3-pointer as regulation expired, and Memphis overcame blowing a 23-point lead for a 117-116 triple-overtime victory over the Spurs on Wednesday.
The Grizzlies were seconds from defeat at the close of regulation and in the first and third overtimes, but showed the fortitude needed to snap a 10-game losing streak in San Antonio.
Memphis had not won at the AT&T Center since sweeping the Spurs in the 2011 playoffs.
"It's the biggest game for us because they've been beating us," Grizzlies forward Zach Randolph said. "The last time we won here was what, the playoffs, right? It's a long time. They have our number. It felt good to get a win, to get that confidence."
Randolph had 21 points and 21 rebounds in Memphis' sixth straight victory. Vince Carter added a season-high 18 points for Memphis (21-4).
The Grizzlies were fresh off snapping Golden State's 16-game winning streak Tuesday night, but they were sharper early than the rested Spurs, who were without injured starters Tony Parker and Kawhi Leonard.
Danny Green scored 25 points, and Tim Duncan had 23 points and 16 rebounds for San Antonio. His jumper rattled in to force the third OT, but he finished just 5 for 15 on free throws.
San Antonio made a season-high 17 3-pointers but was 13 for 27 on free throws, including 5 for 15 by Duncan.
Manu Ginobili added 21 points, but shot an airball on a 3-pointer in the final seconds for the Spurs.
"Everybody tries to win the game," San Antonio coach Gregg Popovich said. "It just didn't fall for him."
Duncan hit a fallaway, high-arcing jumper that bounded on the rim three times before dropping in to tie the game at 111 at the close of the second overtime.
"Whew, man," Randolph said, laughing when asked about Duncan's shot. "Take the life out of you."
But Memphis was able to revive quickly.
After Green's fifth 3-pointer gave San Antonio a 92-89 lead with 2.5 seconds remaining in regulation, Gasol banked in a 30-footer against Ginobili as time expired.
Green tumbled to the floor and injured his knee while colliding in midair with Mike Conley on an outlet pass, giving Memphis a 5-on-4 situation that resulted in Gasol's layup that tied the game at 102 with 9.3 seconds left. Ginobili missed a 7-foot running jumper to end the first OT.
Conley's 3-pointer gave Memphis a 111-109 lead with 2.6 seconds left in the second overtime before Duncan's shot that finally fell in.
"This was really a gut-check type of win," Conley said.
"We definitely needed it mentally more so than anything. We've always felt like we can match up with them and we can play with them, but they are always one or two plays better or just one or two hustle plays or out-execute us and that's been the difference in the series the last couple of years. Finally we get that win."
Grizzlies: Grizzlies G Tony Allen (right corneal abrasion) was a late scratch. Allen, who missed two games earlier this season, had two points, seven rebounds and two assists in Memphis' 105-98 victory over Golden State on Tuesday. ... Memphis is an NBA-best 13-2 against the Western Conference this season.
Spurs: San Antonio has used 15 different starting lineups in 26 games this season. The team started Duncan, Green, Matt Bonner, Cory Joseph and Kyle Anderson for the first time collectively this season. ... The Spurs celebrated International Night, commemorating the team's diverse roster. San Antonio has a league-high nine players born outside the U.S. and also has several former players and draft picks and players, including Memphis' Beno Udrih, Indiana's Luis Scola and Golden State's Leandro Barbosa. Green blocked the 6-foot-9 Randolph twice from behind.
San Antonio gave up a season-high 34 points in the first quarter as Memphis shot 14 for 20 (70 percent), almost exclusively on jumpers. The previous high allowed was 30 points by New Orleans in the Pelicans' victory Nov. 8.
The Spurs were 5 for 10 on 3-pointers in the third quarter in trimming what had been a 23-point, first-half deficit to 71-68.
Grizzlies: Host Chicago on Friday.
Spurs: Host Portland on Friday.