Anthony Davis, LaMarcus Aldridge

San Antonio Spurs forward LaMarcus Aldridge tries to drive around New Orleans Pelicans forward Anthony Davis during the first half of Wednesday's game in San Antonio. The Pelicans rallied for a 121-116 win.

SAN ANTONIO — The New Orleans Pelicans turned three quarters of poor play into an inspiring victory on one of the league’s toughest home courts.

Wednesday night in the AT&T Center, the Pelicans rallied in the final two minutes, defeating the San Antonio Spurs 121-116 for their seventh straight win.

“We just kept battling,” coach Alvin Gentry said. “We weren’t playing (our) greatest. I thought we were kind of a half a step slow in everything we were doing and they were attacking us. We were having trouble controlling the dribble penetration but we just kept plugging away and plugging away.”

The Spurs suffered their seventh home loss this season.

Anthony Davis had 26 points and 15 rebounds to help New Orleans snap a five-game skid on San Antonio's home floor.

The Pelicans (35-26) moved within a half-game of the Spurs (36-26), who dropped to fourth in the Western Conference with the loss.

New Orleans fell behind by double figures midway through the second quarter but rallied behind their superstar center.

San Antonio led until the final two minutes after losing leading scorer LaMarcus Aldrige to a sprained ankle. Aldridge landed awkwardly while defending a running hook shot by Davis with 3 minutes left in the first half.

The Spurs were already without Kawhi Leonard, who has missed all but nine games this season with right quadriceps tendinopathy, and also starting center Pau Gasol.

“We had that a little bit down the stretch today; we felt sorry (for ourselves),” Spurs veteran Manu Ginobili said. “We said, 'OK, we are missing a lot of guys,' and we stopped executing when we needed it the most.”

The Pelicans took advantage, outscoring the Spurs 70-56 in the second half.

Darius Miller pulled New Orleans within 105-102 on a 3-pointer and then tied the game at 106 on a layup with 6:23 remaining. Davis’ alley-oop dunk gave New Orleans its first lead at 114-113 with 2 minutes remaining.

After Spurs point guard Dejounte Murray and the Pelicans’ E’Twaun Moore exchanged 3-pointers, Jrue Holiday collected a turnover by Patty Mills. Holiday was fouled on the play, but missed the ensuing two free throws. Davis fought through the smaller Spurs for a rebound and was fouled, making the two free throws to seal the victory.

“We made plays down the stretch,” Gentry said. “Jrue made a bunch of plays. Obviously, AD’s offensive rebound was really huge.”

Mills and Rudy Gay both missed 3-pointers in the final possession as the Spurs lost for the fifth time in six games.

Holiday finished with 25 points and Rajon Rondo added 13 points and 12 assists for the Pelicans.

New Orleans had not won in San Antonio since 2014 but rallied to win its 18th road game this season.

The rally began late in the third quarter when the Pelicans cut what was a 15-point lead to eight at the close of the quarter.

“We’ve got to try not to get down double digits, but it’s good that we’re able to fight back and we continue to play,” Gentry said. “I think we keep our poise and we don’t panic about it, but I would much rather not be playing from double figures down.”

New Orleans held San Antonio to 21 points in the final quarter.

The Spurs had six players in double figures led by 19 points by Gay.

“I couldn’t be more proud of our group,” San Antonio coach Gregg Popovich said. “Under very, very tough circumstances they keep fighting. As long as they believe in each other and keep working as hard as they are, we’re going to be in good shape.”