DALLAS (AP) -- Dirk Nowitzki says he wasn't thinking about the last time the Dallas Mavericks blew a 30-point lead and lost.
The biggest collapse in franchise history was a long time ago, and he was too busy trying to make sure it didn't happen again.
Nowitzki scored 22 points, Devin Harris hit the go-ahead shot in the final minute and the Mavericks rallied in the fourth quarter after blowing their huge first-half lead, beating the Portland Trail Blazers 103-98 Friday night.
''You're just out there battling,'' Nowitzki said. ''They're a very, very good team. They came back a lot quicker than we wanted it to be, but we kept fighting and got the win.''
LaMarcus Aldridge finished with 30 for Portland, including 18 in the third quarter when the Blazers went in front for the first time at 69-67 after trailing 44-14 early in the second quarter.
But Nowitzki didn't pause to remember Dec. 6, 2002, when the Mavericks lost at the Los Angeles Lakers 105-103 after leading 66-36 early in the third quarter.
Rick Carlisle wasn't dwelling on the blown lead either.
''How many whatever-point leads have we blown this year?'' the Dallas coach said. ''There's been tons of them. We've got to work to prevent it. There's no harder way to do it than what happened tonight.''
The score was tied 98-all when Aldridge missed a shot from the lane and Harris won the scramble for the rebound. He dribbled the length of the floor and hit a leaning shot on the baseline and was fouled by Damian Lillard with 24 seconds left.
''He busted my mouth open, so I knew I wasn't all the way in front of him,'' Lillard said. ''But I figured since that was the second time that he dipped his head into my face, I figured they would call offensive foul. We still had a couple opportunities after that that we didn't take advantage of.''
After Harris' free throw put Dallas up by three, Aldridge's pass went over Lillard's head out of bounds.
Monta Ellis missed two free throws, but Vince Carter slipped between a pair of Portland players for the offensive rebound and was fouled. Carter made both free throws, and Ellis had a steal to seal a wild win that snapped the Mavericks' season-high three-game losing streak.
''I had some big miscues down the stretch,'' said Aldridge, who had 17 rebounds. ''I missed some shots down the stretch. Fighting all the way back, being up and having the opportunity to win and not taking care of business.''
Dallas took its first 30-point lead at 40-10 on Brandan Wright's alley-oop dunk from Ellis early in the second quarter, one of many easy breakaway baskets early.
Thomas Robinson had six points on a 12-1 run that started Portland's comeback, getting the Blazers within 19. That was Dallas' margin to begin the third quarter, when Aldridge took over, scoring six straight early in the period and another six straight later.
The Blazers, who led by 38 in a blowout win over the Mavericks the last time they were in Dallas in January, wiped out the last of the deficit on a 3-pointer by Wesley Matthews to knot it 67-all with 4:02 left in the third.
The Blazers went ahead for the first time at 69-67 on a putback by Aldridge.
''It was unbelievable,'' Wright said. ''We got outscored by I don't know how much after that first quarter being up 40-10. They went on a heck of a run, but all it's going to say in the paper tomorrow is that we got the 'W.'''
The lead changed hands three more times late in the third, setting up a back-and-forth battle in the fourth.
Portland pushed out to an 85-78 lead on another 3 from Matthews, who had 26 points, and a jumper from Mo Williams, but Harris hit a 3-pointer to finish an 8-0 Dallas run for a 90-89 lead.
The Blazers went back up 98-92 on an alley-oop dunk by Aldridge, but Dallas pulled even when Sam Dalembert stole the ball from Lillard and tossed to Ellis for a breakaway layup.
Jose Calderon had 19 for Dallas, including 15 in the first quarter. Ellis had 17 points, eight rebounds and seven assists. Nowitzki had six assists and five rebounds. Harris finished with 12 points.
NOTES: Robinson returned after missing four games with a left knee injury. He fouled out with 7:52 remaining. ... Ellis made his 500th career start. ... The Mavericks shot 53 percent in their 115-110 loss to Denver on Wednesday. It was their best shooting percentage in a loss this season. ... The Blazers had season lows for points in a quarter (10) and the first half (38). The previous low for a first half was 41 in a 90-89 win over Phoenix.