Miami held a 12-point lead early in the fourth quarter, but Portland came back to tie it with 4 minutes left and the teams battled on even terms the rest of the way.
Matthews tied the game with a 3-pointer that came with 56 seconds remaining, after which Chris Bosh scored on a dunk to put Miami back in front.
Another 3-pointer from Matthews with 26 seconds to go gave the Trail Blazers a one-point lead and Miami's Ray Allen followed by missing a 3-point attempt.
Portland won its fourth in a row and Miami has lost back-to-back outings to open a six-game road trip.
Nicolas Batum led the way for Portland with 28 points. Aldridge had 20 and Matthews finished with 18.
Bosh produced 29 points while LeBron James narrowly missed a triple-double with 15 points, 10 rebounds and nine assists.
'How to Train Your Dragon 2' releases 5-minute clip
Turkey considering to use pistachios to heat country’s first eco-city