Updated

Jeremy Lin had 28 points and a career-high 14 assists, Steve Novak made four 3-pointers in the fourth quarter and the New York Knicks ended the Dallas Mavericks' six-game winning streak with a 104-97 victory Sunday.

J.R. Smith scored 15 points in his Knicks debut and Novak had all of his 14 in the final period as New York won for the eighth time in nine games.

In a game of wild momentum swings, the Knicks reeled off 17 straight points in the first quarter, fell behind by 12 in the third, then pulled it out to beat the Mavericks for only the third time in the last 20 meetings.

Dirk Nowitzki scored a season-high 34 points for the Mavericks, who had been playing championship-level defense but became the latest team who couldn't stop Lin.

Playing for the seventh straight game without the injured Carmelo Anthony, the Knicks got a huge lift from Smith, just signed Friday after returning from China. Coach Mike D'Antoni had previously said he wouldn't play Sunday since he hadn't practiced yet, but when swingman Bill Walker also had to sit out with an injury, D'Antoni needed someone at that position, and Smith hit three of the Knicks' 12 3-pointers.

Lin had nine turnovers, tied for the most in the NBA this season, Friday in an 89-85 loss to New Orleans that stopped a seven-game winning streak. He has committed six or more in six straight games, but D'Antoni said Saturday he wanted Lin to keep taking risks.

They paid off Sunday, when Lin got the Knicks back into a game that had seemed to be getting away in the third quarter, before shooters all around him got hot in the fourth.

Novak made four 3-pointers in about 4 ½ minutes of the fourth quarter, then Lin buried one to give the Knicks a 90-81 lead with 6:51 remaining. The Mavs got it back down to two on Jason Terry's 3-pointer with 3:26 left, but Lin answered with a 3, and the Mavs couldn't get closer then three again.

Tyson Chandler capped it off with a dunk and had 14 points and 10 rebounds for the Knicks in his first game against the team he helped win last season's championship. The Mavs made little attempt to keep him, opting instead for future salary flexibility over his defensive presence.

But there had been little slippage, as the Mavs came in holding opponents to an NBA-low 41.4 percent shooting from the field. They were limiting teams to 39.2 percent during the winning streak, but the Knicks carved them up for 54 percent in the first quarter as Lin ran the offense flawlessly.

Long before Linsanity, Lin actually started his NBA career with the Mavs' summer league team in 2010. But owner Mark Cuban said Lin preferred to play closer to home, and he signed with the Warriors, who cut him, as did Houston, in December before the Knicks picked him up off waivers.

"It wasn't luck because there were how many other teams that could have signed Jeremy and the Knicks were the ones who went out and got him," Cuban said. "So they saw something and they were smart enough to go out and get him."

Friday's loss may have ended the Knicks' winning streak, but certainly not the buzz around Lin. "Saturday Night Live" opened with a spoof of Linsanity and Sunday's crowd included Kevin Costner, Eva Longoria, Spike Lee — wearing Lin's No. 4 Harvard jersey — and another famous Harvard product, Facebook head Mark Zuckerberg. Lin's high school coach from Palo Alto (Calif.) High School also made the trip.

Smith checked in to a loud ovation with 5:43 left in the first quarter, just before Terry's 3-pointer gave the Mavs an 18-13 lead. He made a 3-pointer on his first shot and drilled two more during a 17-0 run that made it 30-18 on Lin's 3-pointer with 1:42 remaining in the period. Lin's floater with 1.4 seconds left made it 32-20, giving him 10 points in the period.

But Lin went to the bench to start the second quarter and the Knicks' momentum went right with him. Dallas ran off the first seven points before D'Antoni called time and put Lin back in. The Knicks shot only 32 percent in the quarter but held on to take a 48-45 halftime lead.

Nowitzki had 11 points, including a four-point play, during an 18-7 surge out of halftime, and the Mavs would go up by 12 when his free throws made it 70-58 with 4:17 left in the third quarter. The Knicks closed the period with a 14-5 burst behind eight points from Lin, whose steal and dunk with 12.5 seconds left narrowed it to 75-72.

Notes: Baron Davis was in uniform but didn't play. He expects to make his season debut this week. ... Cuban, on the decision not to re-sign Chandler: "We wouldn't have been champions without Tyson. He's a phenomenal player, he's got incredible heart, he's amazing in the locker room and that's why we went out and got him. But the CBA changed everything and you have to adjust how you build and grow and maintain a team and try to win championship. So we did what we felt we had to do, not because we wanted to do it."