Four days after a 1-0 loss to Tunisia in Rades, Team Melli defeated Algeria 2-1 in Graz, Austria on Tuesday.
Sardar Azmoun and Mehdi Taremi both scored in the opening 20 minutes at the Merkur Arena.
Azmoun found the back of the net with a header in the 11th minute and Taremi rounded Algerian coach Faouzi Chaouchi eight minutes later to make it 2-0.
Algeria center-back Farouk Chafai pulled a goal back in the 56th minute with a header.
Carlos Queiroz’s team have been drawn in Group B of the 2018 World Cup along with Spain, Morocco and Portugal.
Iran national football team will open the campaign with a match against Morocco at Saint Petersburg on June 15.
Team Melli, meanwhile, face Spain in Kazan on 20 June before meeting Cristiano Ronaldo’s Portugal in Saransk five days later.