NEW YORK — In their final game before the All-Star break, the 76ers woke up in the fourth quarter and thwarted a Knicks comeback attempt.

The Sixers improved to 37-21 on the season with a 126-111 win at Madison Square Garden behind a combined 51 points from Joel Embiid and Tobias Harris.

Early in the third quarter, the Sixers were holding a 26-point lead against a Knicks team that went into the night having lost 17 games in a row. A couple of minutes later, Embiid went flying into the announcers’ table, bulldozing Dave Fried, the statistician for the MSG broadcast crew, knocking over a monitor, and nearly taking out actress Regina King.

The moment seemed like the perfect metaphor for the game: a towering team easily toppling what was in its way.

But, by the end of the third quarter, the Knicks had cut the lead to single digits, and what should have been an easy win to close out the pre-All-Star Game portion of the regular season for the Sixers turned into a battle to the end, requiring the Sixers’ stars to stay on the floor.

“I give New York credit. In the third period we had to navigate the most zone that we have faced this year,” coach Brett Brown said. “We were up 26, I think they cut it to eight. Those periods of the game aren’t real healthy for a coach. ... We found a way to win and we look forward to this timely break.”

Before the game, Brown had stressed that his team needed to clean up some things, namely, three-point defense and turnovers. Those two problems resurfaced for the Sixers.

On two consecutive possessions, the Sixers sent passes flying toward players who were completely unaware the ball was coming their way. The majority of their 15 turnovers were unforced errors that surely won’t look good on a second watch.

Additionally, the Sixers struggled from deep, shooting just over 26 percent from beyond the arc through three quarters, while the Knicks seemed to continue to find open shots from three-point range.

“As we rank in the league it’s not an epidemic at all," Brown said of the Sixers’ three-point defense. “But to get where we want to go you’re going to have to get into royalty, and that’s not it.”

Even while the Sixers were racking up their early lead, there were moments that made the game seem as if it was more intense and close than the lopsided score indicated.

“We’re new and still getting used to each other,” Harris said. “We have to communicate more on defense, and a lot of the turnovers happen because guys don’t know each other’s spots and things like that. But I think it’ll be a quick fix.”

For the second night in a row, Ben Simmons was put on a poster. On Tuesday night against the Celtics, it was Jayson Tatum serving up a ferocious dunk over the top of Simmons. This time it was Knicks rookie Kevin Knox, who muscled his way into a crowd-rousing slam that somehow made Simmons look small.

Despite the demoralizing moment, Simmons finished out the night strong with 18 points and seven assists.

Late in the fourth quarter the Sixers decided they had better wake up and take care of business. Harris hit a corner three with just under three minutes to go to put the Sixers back up by double digits, and the Sixers didn’t let the Knicks come up for air through the remainder of the game.

Embiid finished with a game-high 26 points and Harris had his highest scoring night as a Sixer, finishing with 25 points after a rough shooting night against the Celtics on Tuesday.

“You’re not going to see many of those,” Harris said of his 4-of-14 outing against Boston. “I’m a shooter. I know I can shoot the ball, and if I get an off night like that I’ll readjust the next night.”

The Sixers’ next game will be on Feb. 21, when the 26-30 Miami Heat visit Philadelphia.