In a battle between the two hottest teams in the NBA since the All-Star break, it was Coach Jason Kidd’s team, pushed by their biggest trade deadline acquisition, that came out on top Sunday in Boston.

Spencer Dinwiddie, acquired just over a month ago, continued to make an indelible impact on the Dallas Mavericks as he buried a three off a feed from Luka Doncic to give Dallas the lead with nine seconds remaining. The Mavs defense did the rest, forcing Jayson Tatum into a long miss as time expired, giving Dallas a 95-92 victory at TD Garden to open a long east coast road trip with a thrilling win while also snapping Boston’s six-game winning streak.

Dinwiddie helped Dallas overcome a double digit deficit, sparking a 12-4 run to close out the game. In the final four minutes, Dinwiddie finished a contested layup, found an open teammate in the corner and, with the game on the line, nailed the game-winner.

Reggie Bullock missed Sunday’s matchup, but the Mavs were fortunate to get Jalen Brunson and Dorian Finney-Smith back, and Coach Kidd instituted a three-guard lineup, starting Brunson, Doncic and Dinwiddie. Starting his second straight game, Dinwiddie finished with 18 points and four assists. Despite missing the previous game Brunson and Finney-Smith both produced in their return, Brunson finished with 14 points and Finney-Smith ended the night with 18 points. Doncic continued to play at an All-Star level with another all around performance with 26 points, eight rebounds and eight assists.

And it was the last assist that made the difference. Despite defensive pressure from Boston, Doncic was poised in the closing moments with the score tied 95-95. Dallas got the ball in his hands off a pick and roll handoff from Dinwiddie. After turning the corner and finding no avenue to a shot, Doncic crossed over Jaylen Brown and drove toward the basket. The defense collapsed with him, sending three extra defenders his way and leaving three shooters open on the perimeter. Doncic made the correct play, passing to a wide open Dinwiddie, who buried a catch and shoot three to give Dallas the lead.

After the thrilling win, Coach Kidd discussed how Luka impacted the last possession to give Dinwiddie the best look possible.

“They were going to trap him and take the ball out of his hands, but he was going to let his teammates make plays,” Coach Kidd said. “There he got to the paint, he was patient [and] he held on to it as long as he could. He looked into the corner to make sure that he can get it to Spencer at the slot and Spencer did the hardest part and that was catch and shoot.”

Boston entered the game 7-1 since the All-Star break while Dallas was 6-2 since the break, and both teams have relied heavily on their defense to get there. That was evident in a low-scoring first quarter. The teams exchanged baskets early and halfway through the opening frame, Boston had a 17-12 lead. Though the Mavs were playing characteristically tight defense, Boston was unfazed and made multiple baskets with a defender in their face, pushing their lead to seven at one point in the first. However, led by Doncic, Dallas ended the quarter on a 6-2 run in which he scored four points and assisted on the other two. The mini run put the Mavs within a basket, 20-18 after one.

At the start of the second quarter, both teams were still struggling to find a basket. The Mavs shot 8-of-23 from the field and Boston shot 10-of-23 from the field during the frame. Dallas briefly took a one-point lead in the second, but a 10-2 run by the Celtics pushed the Mavs into trouble.

Jaylen Brown started it with a dunk, then found Robert Williams III for a dunk of his own on the next possession. After Jayson Tatum hit a couple of free throws, Trey Burke ended Dallas’ drought with a bucket, but Brown followed with another driving dunk. Seconds later, Williams hit another basket which put Boston in front by seven. Tatum took over from there, scoring seven of Boston’s next nine points and when Marcus Smart drove in for a finger roll, it gave Boston their first double digit lead. However, perhaps foreshadowing the end of the game, Dinwiddie responded by hitting a three-pointer at the buzzer to ensure the Mavs were in position to make a run in the third quarter down by nine, 47-38.

Coming out of halftime Boston hindered Dallas from cutting into their lead by answering every basket the Mavs made. Down by 10 the Mavs needed a spark and Doncic and Finney-Smith provided that spark, by hitting back to back three-pointers and putting them within four, 59-55. Dallas felt the momentum shift in the quarter. After Dinwiddie had a successful trip to the charity stripe, he came back down the court to find a cutting Finney-Smith who finished a dunk. The connection continued on the next possession with Dinwiddie finding Finney-Smith behind the arc and his three-pointer gave Dallas the lead, 63-62.

In the final seconds of the third quarter the two teams went back to exchanging baskets. The Mavs’ final possession of the third would also foreshadow things to come as Burke found Dinwiddie, who nailed a deep three-pointer to give the Mavs a three-point lead. Dallas had an efficient quarter by hitting 11-of-15 from the field and outscored Boston 38-26 to get back into the game and the Mavs carried a 76-73 advantage into the fourth.

Boston was not going to go down without a fight. The Celitcs came out hot by quickly going on a 10-2 run to take back the lead. It was a low scoring fourth, which made each basket that much more valuable. The Mavs turned to Doncic and Finney-Smith for clutch baskets, with each of them hitting a three-pointer to tie up the game at 83-83.

There were under five minutes to play when Brown turned a Mavs mistake into a fast break opportunity that he finished with a layup to give Boston an 88-83 lead. Dinwiddie knew it was clutch time and began to make a run, he converted an and one layup then. seconds later, he had a hot potato pass to get the ball to Finney-Smith in the corner and DFS nailed the three-pointer to recapture the lead for Dallas, 89-88.

The Celitcs responded with a quick four points and just like that the Mavs were back down by three. Doncic had the ball in his hands at the top of key, created a mismatch and took advantage by hitting a stepback three-pointer to tie up the game at 92. Boston had two chances to take the lead back, but Dallas forced both Brown and Tatum into misses. The second of those gave Dallas the ball with 32.4 seconds to play with a chance to take the lead.

Coach Kidd elected not to take a timeout, trusting his team to get the right shot. Dallas dribbled the clock down inside 10 on the shot clock before initiating their offense and getting the ball into Doncic’s hands. He utilized his quickness to get past his defender and as he approached the paint a flurry of defenders flew to trap him. Luka did not panic and while looking to a wide open Kleber in the corner, he shot a no look pass to Dinwiddie, who nailed the open 28-foot three-pointer to give Dallas a three-point lead.

Boston called timeout and drew up a play that got Marcus Smart a three-point look, but he misfired. The loose ball was originally awarded to Boston, but a successful challenge from Coach Kidd made it a jump ball. Boston won the tip, gained possession and quickly called timeout with 3.5 seconds left in the game. The Celtics diagrammed a play to get Tatum the ball but Dinwiddie was right on his hip playing stifling defense, which made for a difficult three-point shot. Tatum got a shot off, but it had too much on it and bounced off the back of the rim.

After the game, Coach Kidd had high remarks for the team and their ability to handle a hostile environment.

“I thought the execution late game on the offensive and defensive end was big for us,” Coach Kidd said. “That’s playoff type basketball that was played this afternoon on both sides. It was physical [and] both teams made runs and they responded. It’s hard to win in this building and the guys stayed together and found a way to do it.”