Morocco opened the scoring after four minutes when Tannane's audacious shot from the centre circle caught advancing goalkeeper Yazeed Abulaila off guard.
Jordan, set to make their World Cup debut in 2026, hit back with a second-half double from Ali Olwan's header and penalty in the 48th and 68th minutes respectively.
But Hamed Allah scored three minutes from the end to force extra time before grabbing the winner from close range.
Morocco enjoyed another success despite missing several Europe-based players ahead of the Africa Cup of Nations.
They became the first African and Arab nation to reach the semi-finals of a World Cup – also in Qatar three years ago - eliminating Spain and Portugal before falling to France.
Morocco were crowned Under-20 world champions in October when they beat Argentina 2-0 in the final to become the first Arab nation to lift the trophy.
The under-17 side reached the World Cup quarter-finals, while the under-23 team won the Africa Cup of Nations and a place at the Paris 2024 Olympics, where they took bronze.
Morocco is set to host AFCON from December 21st to January 18th.
