SAN ANTONIO — The Knicks were not in awe of the Spurs or their unbeaten streak inside their home building. Ending that streak, not how much of an upset it would be, was all that was on the Knicks’ minds Friday night.

“I’m the wrong guy to ask about upsets as though this is like David and Goliath,” Derek Fisher said. “It’s basketball.’’

“We’re coming here to win,” Carmelo Anthony said.

Most teams probably have that same outlook, then leave the AT&T Center upset. And the Knicks had to feel devastated after falling to the Spurs, 100-99.

The Knicks (18-20) had a chance to win the game on the final possession, but Jose Calderon’s corner three- pointer didn’t fall. The Spurs improved to 22-0 at home this season and extended their overall winning streak here to 31 games.

After winning the first two games of this trip — in Atlanta and Miami — to extend their winning streak to three games, the Knicks gave the Spurs a battle. They cut a 12-point fourth-quarter deficit to 98-97 on Arron Afflalo’s three-pointer with 49.3 seconds left.

Tony Parker hit a floater with 33.3 seconds left to give the Spurs a 100-97 lead, but Kristaps Porzingis threw down an alley-oop pass to bring the Knicks within one. After Parker misfired, Anthony had the ball, but the Spurs smothered him. He passed the ball to Calderon, who was wide open but couldn’t convert.

Porzingis had a big game with 28 points and 11 rebounds. Anthony had 20 points, 12 rebounds, three assists and two blocked shots but shot only 5-for-15.

Kawhi Leonard, last season’s defensive player of the year, frustrated Anthony. The Spurs’ overall defense suffocated him and forced other Knicks to beat them.

Leonard led the Spurs with 19 points and 12 rebounds. LaMarcus Aldridge added 16 points and nine rebounds and Tony Parker, back after missing the past two games with hip soreness, had 16 points and eight assists. Manu Ginobili also had 16 points.

The Spurs scored the first seven points of the fourth quarter to open an 86-74 lead. After Parker’s basket made it 92-80 with 5:27 left, the Knicks scored the next nine points, drawing within 92-89 on Anthony’s jump shot with 2:49 to go.

After Ginobili’s layup, Afflalo buried a three-pointer to make it 94-92 with 2:03 left. Aldridge hit an open jumper to push it to four, but Anthony answered to make it 96-94 with 1:27 to go.

Porzingis and the Knicks got off to a good start and went ahead 41-32 with 8:54 left in the second quarter. He had 15 points in that time. But the Knicks went more than five minutes without scoring and lost the lead. The Spurs scored 13 consecutive points, ended the second quarter on a 20-8 run and led 52-49 at the half.

Porzingis remained hot in the third quarter, scoring nine points and giving the Knicks a 64-63 lead with a pull-up jump shot with 6:51 to go. But Parker had six points and Tim Duncan five in a 16-8 run that put the Spurs up 79-72.