NEW YORK — Carmelo Anthony and the Knicks know it will never be easy against the Celtics.
Not beating them in one game, and certainly not beating them for a division title.
But pulling out the kind of nail biter that’s long gone Boston’s way in this rivalry only reinforced the Knicks’ belief that they can do it — and even the Celtics see a difference.
Anthony scored 37 points, including a pair of free throws with the game tied and 16 seconds left, and New York survived a seesaw season opener Sunday to edge the Celtics 106-104.
‘‘Most importantly for us, as a new team, we showed something,’’ Anthony said. ‘‘We came together as a team. Even when we got down, there wasn’t no frowns. Nobody was down. Mentally everybody was still up about it, and we willed our way to this win.’’
Amare Stoudemire added 21 points and Toney Douglas had 19 for the Knicks, who led by 17 in the first half, trailed by 10 in the fourth quarter, then pulled out a thrilling Christmas victory in the delayed opener to the 2011-12 season.
Rajon Rondo had 31 points and 13 assists, nearly leading the Celtics back without an injured Paul Pierce. But Kevin Garnett missed a jumper just before the buzzer, the kind of shot Boston always seems to make against the Knicks.
‘‘They seem to have a little swag and confidence behind them,’’ Garnett said. ‘‘It’s good for the city. It’s good for the Knicks. I'm going to see how consistent they are with that, but for the most part Carmelo played really well.’’
Brandon Bass had 20 points and 11 rebounds in his Celtics debut, and Ray Allen added 20 points.
Garnett finished with 15 points. He and Allen had a sleepy Christmas start, with Rondo keeping the Celtics in the game until they got going in the second half.
‘‘I thought we were as soft as you could be in the first quarter and then I thought we joined in to the 2011-12 season, and from that point on I was pretty happy with the way we played,’’ Celtics coach Doc Rivers said. ‘‘I thought we competed well.’’
But it wasn’t enough against the Knicks, who withstood a costly knee injury to first-round pick Iman Shumpert to beat the team that swept them out of the first round of last season’s playoffs. Shumpert will miss two to four weeks with a sprained right knee ligament.
Pierce has a bruised right heel but hopes he can return Tuesday when the Celtics visit the Miami Heat.
Even without him, the Celtics fought back to tie it at 69 on Rondo’s layup midway through the third quarter. They surged ahead by eight going into the final period after Bass scored the final six points, then extended it to 89-79 on Bass’ jumper to open the fourth.
Anthony, who scored 20 in the fourth, tied the game at 100 on a 3-pointer with 3:25 to play. It stayed tight until he was fouled on a drive with 16.3 seconds left, making both for a 106-104 lead. Rondo grabbed the rebound of Marquis Daniels’ potential go-ahead 3-pointer to give the Celtics a final chance, but Garnett was off on his jumper, then appeared to shove the Knicks’ Bill Walker away.
Coming off their first winning season in a decade, the Knicks added a defensive presence by signing Tyson Chandler away from the NBA champion Dallas Mavericks and have loftier expectations than they've seen in years. The original NBA schedule had them opening against Miami, but instead they got a chance to see if they've closed the gap against Boston.
‘‘I think we wanted to come out and set the tone early,’’ Stoudemire said. ‘‘It’s a long year but this game was very important for us to get off to a great start.’’
Though the Celtics won all eight meetings last season, the Knicks have been listed some places as the favorites in the Atlantic Division, which the Celtics have ruled since their Big Three came together in 2007.
‘‘Everybody knows how optimism kicks in before the season starts, but then once reality sets in after the first month of the season, we'll see,’’ Pierce said before the game. ‘‘But it’s definitely a possibility. I mean, they have the talent, but we have the talent, too.’’
But the Knicks will be without newcomer Baron Davis for a few weeks because of a herniated disc in his back, and now Shumpert is out, leaving little depth in the backcourt.
The Knicks led 49-32 with 7½ minutes left in the first half before the Celtics cut it to 62-52 at halftime.
The first game since renovations began at Madison Square Garden included the usual cast of celebrities such as Alicia Keys, Chris Rock and John McEnroe, and some new confusion, as at least one Celtics player had to ask how to get to the court from the new visitors’ locker room.
Notes: Rivers said Pierce may come off the bench when he does return, since he’s had only one practice so far. ... The Knicks were without Mike Bibby, who dressed but didn’t play because of a sore back. Reserve Jared Jeffries was lost during the game to a sore right calf and will miss a week or two. ... Stoudemire provided pregame breakfast to MSG staff in appreciation of the support in his first season with the team.