The unseeded Alami upset Hicham Arazi, the No. 3 seed and 1997 champion, 7-6 (7-5), 6-3.
Alami, making his 12th appearance in this tournament, had lost the previous two matches against Arazi and trails the head-to-head series, 4-3.
Arazi has just a 7-9 record since reaching the semifinals at the season-opening event in Adelaide. A shoulder injury limited him to just one tournament in the last six weeks.
Alami posted his first match win of 2002 in an ATP event. Last week, he fell in the first round of a Challenger event in Tunis.
Alami was joined in the second round by countryman Younes El Aynaoui, the second seed who defeated France's Nicolas Coutelot, 6-2, 7-6 (7-3).
El Aynaoui is seeking his second title of the year, having won in Doha in the first week of the season. He also reached the final in Dubai and is 13th in the ATP Champions Race.
No. 5 seed Julien Boutter of France survived losing a grueling second-set tiebreak to outlast Russia's Nikolay Davydenko, 7-5, 6-7 (9-11), 6-4.
No. 7 Olivier Rochus of Belgium, the only other seed in action, was routed by Georgia's Irakli Labadze's 6-0, 6-1.
In matches involving unseeded players, Australia's Wayne Arthurs defeated Russia Andrei Stoliarov, 6-3, 6-4; France's Paul-Henri Mathieu bounced Jan Vacek of the Czech Republic, 6-1, 6-2; and Russia's Mikhail Youzhny got past Spain Alex Calatrava, 7-5, 7-6 (7-2).
France's Anthony Dupuis advanced when Germany's Lars Burgsmuller retired in the second set with a left wrist injury. Dupuis was leading, 6-2, 3-1, at the time.
In a battle of Spaniards, David Sanchez reached the second round when Sergei Brugera retired in the second set with an undisclosed injury. Sanchez was leading, 6-2, 2-1.
Notable deaths of 2014 [PHOTOS]