It came 15 minutes after Khazri's pin-point pass led to Fakhreddine Ben Youssef's equalizer.
Khazri added the second in the 66th minute, running unmarked on to a low cross to tap into an open goal.
Panama: Penedo (7), Escobar (7), R Torres (7), Gomez (6), Barcenas (7), G Torres (6), Machado (6), Ovalle (6), Avila (5), Godoy (5), J Rodriguez (6). "This is a great day for Tunisia", said man of the match Ben Yousseff.
Japan reach last 16 despite loss to Poland
Japan and Senegal finished with the same number of points, the same goal difference and the same number of goals scored. Japan , therefore, reached the round of 16 along with Colombia, with England or Belgium lying in wait.
The Colombian was quick to dismiss one journalist's claim that Panama were the worst team at Russian Federation 2018, pointing out how the country's infrastructure compares to many of their FIFA World Cup rivals. However, Tunisia did not win a game in any of those tournaments.
In the first half, Tunisia took their time too much in imposing themselves upon the game and were punished by going behind.
The African nation completed the turnaround in the 66th minute as Khazri registered a goal to go with his assist with a neat finish form close range.
Khazri, who had always looked unsafe, then obliged in the 66th minute, running unmarked on to a low cross from defender Oussama Haddadi to tap into an open goal.
EU, China vow to uphold global trade order despite divisions
Tariffs on an additional $16 billion in Chinese products will go into effect after a public review period is completed. Brussels and Beijing recently announced new tariffs on USA goods in retaliation for moves by the Trump administration.
Panama's defeat means they have become the first nation since Serbia and Togo in 2006 to lose each of their first three World Cup games.
Panama's endeavor throughout the opening stages of the game, where they harried Tunisian possession continuously force errors, was reaping dividends and the goal was a just reward for starting the game the brighter of the two sides.
Panama thought they had superbly equalised in the 73rd minute when Edgar Yoel Barcenas curled home a lovely effort, but the referee had already blown for a foul and they were unable to hit the back of the net again as Tunisia saw out their victory.
In the end it was Tunisia who avoided last place in Group G with their first World Cup win since 1978 but Panama exit Russian Federation on the back of a spirited performance befitting of football's grandest stage. He has shown what he can do at this World Cup, and now needs to translate this form into his club career.
Download iOS 12 Public Beta IPSW for iPhone, iPad, iPod [Install Guide]
Rather not wait for Apple's newest software? Your old purchases will still show up, but the app's design got an overhaul. Yesterday, Apple finally pushed the iOS 12 beta to those participating in the Beta Software Program.