Saber Khalifa's faint touch on Khaled Korbi's 34th-minute free kick helped guide the ball home and send Tunisia into a surprise lead over its North African rival. Substitute Youssef Msakni made it 2-0 with a fine solo run and finish in the 76th.
Houssine Kharja scored a contentious late goal for Morocco to set up a nervous finish for the Tunisians at Stade de l'Amitie. Ahmed Kantari was clearly offside when he set up Morocco's captain.
Kharja nearly stole a point for Eric Gerets' disappointing team in stoppage time but he fired just over the crossbar.