Both the Celtics and the Knicks featured vintage performances Sunday afternoon at TD Garden. For the Celtics, it was Paul Pierce and his 29 points. For the Knicks, it was Carmelo Anthony and his 36 points — on abysmal 10-for-35 shooting.

It was a performance out of his Denver days, with Anthony trying to do it all himself, even as his shots weren’t falling, and the Celtics beat the Knicks, 97-90, in overtime.

Part of that was the defense of Brandon Bass, who frustrated the Knicks star until he got in foul trouble, with Celtics coach Doc Rivers calling Bass “the star of the game, as far as I’m concerned.”

Part of that was the stubbornness of Anthony taking 35 shots — including seven from beyond the arc, all of which he missed — despite it not exactly being his day.

“At the end of the day, you’re going to live or die with your go-to guy,” New York’s Raymond Felton said. “You have something that works for you all game — screen and roll was great for us. But when the game goes down to the line, you’re going to give the ball to your man who puts the ball in the basket for you.

“I was able to get in the paint and hit some big shots, but when the game is on the line, you’re going to give the ball to No. 7.”

Anthony missed seven of 10 shots in the fourth quarter, and then missed 3 of 4 in overtime.

And then there were the free throws.

Though Anthony made a whopping 16 free throws, it was the two he missed that loomed large after the game. He was put on the line by Jeff Green’s fifth foul with 1:50 to go in the fourth quarter. He missed both. The game went to OT.

“I was trying to win the basketball game,” Anthony said about his performance overall. “It would have been a great feeling to close it out here in Boston, so I was trying to do whatever I could to win the basketball game.

“I was just trying to get aggressive. I missed a lot — a ton — of shots today. We as a team didn’t shoot the ball well, I didn’t shoot the ball well. But defensively, we were still there. We look forward to Wednesday [Game 5], I can tell you that.”

Anthony added seven turnovers to his stat line on an afternoon in which he did his best to make up for the loss of J.R. Smith, the Knicks’ second-leading scorer and the NBA’s Sixth Man of the Year. Smith was suspended for Game 4 by the NBA after he elbowed Jason Terry in the face in Friday night’s Game 3.

“He’s going to get his shot attempts, he’s going to make his tough shots, but when you are running three guys at him, hopefully it wears him down,” Terry said of Anthony. “I just thought we fouled him a lot, but we had to. He’s been killing us.”

Anthony had scored 36, 34, and 26 points in the Knicks’ first three games against the Celtics, all of them wins for New York.

But in those games, Anthony had backup in Smith and Felton. In Sunday’s game, Smith’s absence put more pressure on the shoulders of Anthony.

“As far as J.R. goes, we miss him, I missed him out there,” Anthony said. “But J.R. being out there doesn’t change the way I shoot the basketball. Those shots, I’ve been taking them the whole series. They weren’t falling.”

The Knicks shot 34.4 percent from the field. Without Anthony’s 10 for 35 (28.6 percent), it was an only slightly more palatable 38 percent.

“He missed some shots, but as a team we couldn’t make shots,” Knicks coach Mike Woodson said. “We struggled. Their defense had a lot to do with that.”

The Celtics clearly tried to key on Anthony, to let the rest of the Knicks beat them, and that certainly had an effect. He had Bass on him. He had Green on him.

He even had Kevin Garnett on him.

So Anthony did his best to be aggressive, to get the Celtics in foul trouble. That part worked. His shooting didn’t.

After the game, Anthony was resigned to the fact that the opportunity for a sweep was gone, but the opportunity to move on to the second round was still very much intact.

“My mother always said there’ll be days like this,” Anthony said. “We’ll take it for what it’s worth, put this one behind us, and get ready for Wednesday.”