For the second consecutive game, a role player scored his career high as the New Orleans Pelicans came away with a victory.

Backup center Alexis Ajinca had a game-high 24 points, including the winning basket with 25.9 seconds left, and the Pelicans turned back the Miami Heat 104-102 on Friday night at the Smoothie King Center.

“(The career high) feels great, feels even better when you win,” said the 7-foot-2 Ajinca. “It was a very big win. I’m very happy it happened tonight, and hopefully it keeps going that way so I can help my team even more.”

The victory was the season-high-tying fourth in a row for New Orleans (31-27) and gave it a season 2-0 sweep of the Heat (25-32) for the first time since the 2008-09 season. More importantly, it enabled the Pelicans to stay in the chase for the Western Conference’s eighth playoff spot. They entered the game 1½ games behind eighth place Oklahoma City, which played at Portland late Friday night.

Miami had won its previous two games and three of four.

Eric Gordon drove into the lane and bounce passed to Ajinca for the go-ahead layup. The intent of the play, Ajinca said, was more to get Luke Babbitt open for a 3-pointer.

“I was to be maybe a decoy for Luke,” Ajinca said. “But they went over on Luke, and I went to the basket. So, Eric got the ball to me inside. It was either going to go to Luke or me.”

Miami then had two chances to tie or take the lead, including the first after Omer Asik blocked a shot by Hassan Whiteside only to disconnect with Gordon on the outlet pass, resulting in a turnover.

The game ended with Heat star Dwyane Wade missing a 3-point attempt at the buzzer over former Miami player Norris Cole. Wade said the plan was to run a play inside for Whiteside, who mistakenly came up to do a pick and roll. The Pelicans had that covered.

“So, in the quick decision to bring the guard up knowing (the Pelicans) would switch and I’d have a smaller guy, I tried to get a shot up,” Wade said.

Gordon, who made four of six 3-point tries in scoring 20 points, had hit a big 3 with 2:21 remaining that tied the score at 98. However, with score tied at 100, Tyreke Evans, who had 19 point and 11 assists, fouled out when he charged into Miami’s Henry Walker.

Ajinca had gotten an layup on an assist from Gordon with one minute left, tying the score at 102. Wade then lost the ball, went to the floor to retrieve it and called time out with 38.7 seconds left. More importantly, there were two seconds on the shot clock. When the Heat came out of the timeout, Walker’s 3 attempt didn’t beat the shot-clock buzzer, setting up Ajinca’s winner.

Ajinca scored five quick points inside to start the fourth quarter, as the Pelicans began chipping away at a nine-point deficit.

In a game in which the Pelicans shot 51.3 percent and the Heat 48.8, defense set up another New Orleans comeback victory.

Miami’s Mario Chalmers made a 3-pointer at 9:33 of the fourth for an 85-79 lead. However, the Pelicans held the Heat to one basket — another 3 by Chalmers at 8:22 — for the next 4 minutes, 10 seconds in tying the score at 88.

“We weren’t guarding the ball,” coach Monty Williams said. “In the fourth, we just said, ‘Look, we’ve got to guard the ball, and we’ve got to stop the ball in pick-and-roll.’ ”

The Pelicans led 65-64 midway of the third quarter, but trailed 74-67 lead with 3:03 left after going 4 minutes, 51 seconds without a field goal. The drought ended on Ajinca’s tip-in at 1:45, cutting the lead to 75-70.

But point guard Goran Dragic asserted himself with his play-making, and when Walker — who signed a 10-day contract on Feb. 21 — sank his third 3-pointer with 39.5 seconds left, Miami led 82-72. The quarter ended with the Heat leading by nine, a bad sign with the Pelicans coming into the game 5-21 when trailing after three.

The score was tied at 54 after a sizzling first half in which the Pelicans shot 56.1 percent and Miami 54.8.

NOTE: Pelicans All-Star Anthony Davis received his January NBA Community Assist Award from Hall of Famer Bob Lanier before Friday’s game. … There was a moment of silence before the game to honor Earl Lloyd, the first African-American to play in an NBA game and first black assistant coach. Lloyd, who played nine years in the NBA beginning in 1950, died on Thursday at age 86.