Matos, the MVP of the Mozambique League, hit a pull-up three-pointer to give his team an 81-78 lead with 29 seconds remaining and Morocco were unable to come back into the contest.
The 24-year-old guard went on to finish with 23 points to lead all scorers.
Morocco's Soufiane Kourodu came up with 21 points and 11 rebounds, but the North Africans had to finish the game without Reda Harras and Abderrahim Najah who fouled out in the final quarter and it proved costly.
Kourodu, a 2.10m center, dominated the painted area and Abdelhakim Zouita, Morocco's super athletic forward, added 19 points, but it was the combative Mozambican team that got to celebrate the taste of victory.
Mozambique may have avoided facing the host country in the first stage of the knockout round, but will instead take on Nigeria in Wednesday's Round of 16.
Turning Point: Matos' pull-up three-pointer late on changed the course of the contest for good.
Stats Don't Lie: Morocco made just 14 of 23 free throw attempts (61 percent) and in such a close game, it proved costly.
Game Hero: Even though Matos may be guilty of over-dribbling, he was the game-changer.
The Bottom Line: Mozambique didn't move the ball well but still managed to beat Morocco. Facing Nigeria will likely prove to be a tall order. Morocco only had themselves to blame for the loss, especially after leading by as many as 14 points.