TORONTO — Paul Pierce blocked Kyle Lowry’s shot from the lane on the final play of the game, and the Brooklyn Nets held off the Toronto Raptors 104-103 in Game 7 on Sunday to advance to the second round of the playoffs.

The Nets will begin the conference semifinals at Miami on Tuesday night to play the two-time defending NBA champion Heat.

Leading by one point, Brooklyn used its final timeout after failing to inbound the ball. On the second opportunity, Shaun Livingston tried a lob pass to Pierce, but Terrence Ross got a hand on the ball and then knocked it off Pierce and out of bounds for a turnover.

Toronto used a timeout and gave the ball to Lowry, whose driving shot was blocked by Pierce as time expired. Lowry lay prone in the key as the Nets surged onto the court in celebration.

Joe Johnson scored 13 of his 26 points in the fourth quarter to lead the Nets. Marcus Thornton scored 17, Kevin Garnett had 12 points and 11 rebounds for his first double-double of the series, and Deron Williams added 13 points.

Amir Johnson fouled out with 20 points and 10 rebounds for Toronto, which trailed by 10 with just over six minutes remaining before storming back and having a chance to win it at the buzzer.

Lowry finished with 28 points and DeMar DeRozan 18 for the Raptors, who fell to 0-2 in franchise history when playing in a Game 7. Toronto lost Game 7 of the conference semifinals to Philadelphia in 2001.

The Raptors, who won the Atlantic Division and set a franchise record with 48 wins, have not won a playoff series since 2001, losing in all three appearances.

Brooklyn led 81-73 to begin the fourth quarter, but Toronto cut the deficit to five at 90-85 on a layup by Lowry with 7:21 left.

Joe Johnson hit a driving hook shot on the next possession, then followed with a 3, putting the Nets up 95-85 with 6:18 remaining.

Patrick Patterson, who missed two key free throws late in Toronto’s Game 3 loss, hit a pair from the line with 56 seconds left, bringing the Raptors to within four at 101-97. Patterson finished with 16 points.

After a missed shot by Pierce, Lowry was fouled and made both free throws, making it 101-99 with 25 seconds remaining.

Trying to force a steal, Lowry fouled Williams on the inbound pass. Williams missed the first but made the second, putting the Nets up three at 102-99. After Toronto called a timeout, Lowry drove for a layup to cut it one at 102-101 with 16 seconds to go.

Toronto put Livingston at the foul line and he made both shots, restoring the Nets’ three-point lead, but Ross drove for a layup to cut it to one again with 8 seconds left — setting up the frantic finish.

Amir Johnson picked up his fourth and fifth fouls early in the third quarter and Brooklyn led 67-55, its biggest lead of the game, after a pair of free throws by Williams at 9:04.

But Toronto went on an 8-2 run as the Nets missed eight straight shots before Andray Blatche ended the drought with a dunk. Alan Anderson made a jumper and Blatche added a layup, restoring Brooklyn’s 12-point edge. DeRozan hit a buzzer-beating 3 to cut it to 81-73 heading to the fourth.

SPURS 119, MAVS 96

SAN ANTONIO — Tony Parker scored 32 points and the San Antonio Spurs led by as many as 31 on their way to 119-96 victory over the Dallas Mavericks, closing out a tense first-round series Sunday in seven games.

Last season ended for the Spurs with a Game 7 loss in the NBA Finals against the Miami Heat. Facing a much earlier end, San Antonio rode a raucous home crowd and overwhelmed Dallas in the deciding game of a physical series.

There were two technical fouls and two flagrant fouls in Game 7 and two more flagrants reversed upon review.

Parker was assessed a technical with 31.6 second left in the first quarter after making a layup on and jawing with former teammate DeJuan Blair as the two ran down the court. They have been talking smack to each other all series and Parker was clearly frustrated with the hard fouls committed by Blair on his drives earlier in the series.

Blair was later assessed a flagrant foul for elbowing Ginobili in the face on a drive. After the foul, Blair stared down San Antonio coach Gregg Popovich, who was screaming at officials over the severity of the foul.

The flagrant foul energized the Spurs, who went on a 14-2 run to take a 51-27 lead with 8 minutes remaining in the first half.

Duncan dove into the Mavericks bench during that run to save a loose ball and start a fast break.

Later, Vince Carter tackled Ginobili in the lane three minutes into the second quarter. The play was initially ruled a flagrant foul but was reversed when reviews showed Carter was trying to hold Ginobili up as both tumbled out of bounds.